如何通过Python中的Splinter访问Selenium Webdriver

问题描述 投票:0回答:1

我目前正在使用Splinter构建一些Web自动化脚本,到目前为止还不错,但是我遇到了一个问题,即我实际上无法使用Splinter包装器功能对其进行修复。但是,我相信即使我主要使用Splinter,也可以找到可以使用Selenium Webdriver函数进行修复的解决方案。

我相信几年前就已经做到了,但是无论我在哪里搜索(文档,Google,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

似乎都不起作用。

有人知道如何正确执行此操作吗?让我知道您是否需要更多信息。感谢您的帮助。

splinter
1个回答
0
投票

硒通过driver浏览器属性公开:

>>> from splinter import Browser
b>>> b = Browser()
>>> b.driver
<selenium.webdriver.firefox.webdriver.WebDriver (session="e607ceaa-2c63-435e-9991-432376102bf5")>
>>> 
© www.soinside.com 2019 - 2024. All rights reserved.