1
私はRSeleniumを使用して、マネージャに関する情報を持つデータフレームを構築しています。私はドロップダウンリストで要素を選択する問題があります。RSeleniumは指定されたパラメータを持つ要素を見つけることができません
Selenium message:no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="ddlMunicipio"]"}
(Session info: chrome=58.0.3029.110)
(Driver info: chromedriver=2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9),platform=Windows NT 10.0.14393 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 140 milliseconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '3.2.0', revision: '8c03df6', time: '2017-03-02 09:34:51 -0800'
System info: host: 'PATY-FRAN', ip: '192.168.0.20', os.name: 'Windows 10', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9), userDataDir=C:\Users\victor\AppData\Local\Temp\scoped_dir6076_6551}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=58.0.3029.110, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=}]
Session ID: 0815f4f9dcca9d364a7c15b4a50352e7
*** Element info: {Using=xpath, value=//*[@id="ddlMunicipio"]}
Error: Summary: NoSuchElement
Detail: An element could not be located on the page using the given search parameters.
class: org.openqa.selenium.NoSuchElementException
Further Details: run errorDetails method
私はあなたの助けを借りて感謝するでしょう:私は次のエラーを取得し、最後の行で
> require(RSelenium)
> remDr<-remoteDriver(browserName = "chrome")
> remDr$open()
> enlace<-'https://www.sisben.gov.co/atencion-al-ciudadano/Paginas/Directorio-administradores.aspx'
> remDr$navigate(enlace)
> remDr$findElement(using = "xpath", '//*[@id="ddlDepartamento"]/option[2]')$clickElement()
:
私のコードは次のようです。
URLに入力ミスがあるようです。多分これがあなたの問題の原因です。 selectタグと対話するために使用できる 'selectTag'メソッドもあります。 – jdharrison
jdharrison私のコードをコピーする際にエラーが発生しました。元のスクリプトで問題ありません。私の問題は、ナビゲーションではなく要素を見つけることにあります。私はあなたの甘やかされた方法でお試しになります。 – fcochaux