-1

@初心者なので、一日中試してみましたが、ドロップダウンから選択できないため、以下にこだわっています。

テキストを入力し、ドロップダウンが表示されたら値を選択します。

私が使用している参照サイトは www.irctc.co.in...JUST FOR TEST です

最後にEclipse Javaを使用する

driver.findElement(By.xpath("//input[@name='stationFrom']")).sendKeys("PUN");
Select test = new Select(driver.findElement(By.xpath("//ol[@id
    ='no_0a_autocomplete_list']/li/span[text()='(PUNE)']")));

firebug で xpath の選択を確認しようとすると、PUN が入力された後の正しいパスが表示されます。ただし、テストを実行すると、次のエラーで失敗します。

org.openqa.selenium.NoSuchElementException: no such element
  (Session info: chrome=29.0.1547.76)
  (Driver info: chromedriver=2.3,platform=Windows NT 6.2 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 29 milliseconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.33.0', revision: '4e90c97', time: '2013-05-22 15:32:38'
System info: os.name: 'Windows 8', os.arch: 'x86', os.version: '6.2', java.version: '1.7.0_17'

この質問で解決策を試しました: Selenium Webdriverで xpath を使用してドロップダウン値を選択する必要がありますが、機能しませんでした。

4

1 に答える 1