以下はselectメソッドを使ってドロップダウンから値を選択するセレニティのテストケースのコードスニペットです。そして、次のステップは、提出をクリックすることです。しかし、送信ボタンをクリックしようとすると、ページはリフレッシュされません(同じページをリフレッシュします)。セレンのWebドライバは、ページをリフレッシュするまで待つ
を投げます。私のために働く唯一の解決策はthread.sleep()
です。
私はすべて以下のオプションを試してみましたが、運がなかった:(
explicit wait()
、wait.until(Exceptedcontions.visibility)
、element to be clickable()
など、目のウェブ上のすべてのソリューションを試してみました。
私はAでthread.sleep()
3-4回を使用していましたテストケースと私は多くの時間を要する約100のテストケースを持っています。
@Test
@Timeout(group = Group.SLOW)
public void testProvider() throws InterruptedException {
proceedToProvider();
new Select(driver.findElement(By.id("searchId"))).selectByVisibleText("Search");
Thread.sleep(2000);
driver.findElement(By.id("btnSubmit")).click();
timeSplit("Search submitted");
以下は、他のソリューションを使用しているときに表示されるエラーです。上記の方法
org.openqa.selenium.WebDriverException: unknown error: Element is not clickable at point (1289, 141). Other element would receive the click: (Session info: chrome=53.0.2785.116) (Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 168 milliseconds Build info: version: '2.49.1', revision: '808c23b0963853d375cbe54b90bbd052e2528a54', time: '2016-01-21 09:37:52' System info: host: 'ALAKASIMA01-W7L', ip: '10.145.45.233', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_73' Driver info: org.openqa.selenium.remote.RemoteWebDriver Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, chrome={chromedriverVersion=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4), userDataDir=C:\Users\kasima01\AppData\Local\Temp\scoped_dir6628_12218}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=53.0.2785.116, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}] Session ID: 8bf0b4cc7efc715015509f4be345d14d
@Test \t @Timeout(グループ= Group.SLOW) \t公共ボイドtestProviderSearchDataShareOnは()InterruptedExceptionある、にValidationException { \t \t proceedToProviderScreen()を投げます。 \t \t新しいselect(driver.findElement(By.id( "searchId"))))selectByVisibleText( "Search"); // \t \t Thread.sleep(2000); \t \t WaitForElementToLoad( "id"、 "btnSubmit"、 "20");同じ要素がクリック可能なエラーではありません。 – maddie
一部の要素がターゲット要素をカバーしていると考えてください。障壁を取り除く必要があります。 –