我目前正在使用Splinter构建一些web自动化脚本,到目前为止还不错,但我遇到了一个问题,我无法使用Splinter包装器函数来实际修复它。但是,我相信我可能已经找到了一个可以使用Selenium Webdriver函数修复的解决方案,尽管我主要使用的是Splinter。
我相信我几年前就这样做过,但无论我在哪里搜索(文档,谷歌,Stackoverflow),我似乎找不到任何关于这方面的东西,所以也许它不再是一个功能了?
不管怎样,基本上我需要访问Selenium Webdriver函数。
根据我的记忆,我相信代码是这样的:
browser = splinter.browser("firefox")
brower.visit("google.com")
browser.webdriver.find_element_by_id('loginForm') #This is calling the selenium web driver direcetly, not the Splinter find_by_id function. .webdriver .driver
这两种方法似乎都不起作用。
有谁知道如何正确地这样做吗?如果你需要更多的信息,请告诉我。谢谢你的帮助。
发布于 2019-09-27 09:45:08
selenium由driver浏览器属性公开:
>>> from splinter import Browser
b>>> b = Browser()
>>> b.driver
<selenium.webdriver.firefox.webdriver.WebDriver (session="e607ceaa-2c63-435e-9991-432376102bf5")>
>>> https://stackoverflow.com/questions/58106735
复制相似问题