【问题标题】:How To Access Selenium Webdriver Through Splinter in Python如何在 Python 中通过 Splinter 访问 Selenium Webdriver
【发布时间】:2019-09-25 21:26:03
【问题描述】:

我目前正在使用 Splinter 构建一些 Web 自动化脚本,到目前为止效果还不错,但我遇到了一个问题,我无法使用 Splinter 包装函数来修复它。但是,我相信我可能已经找到了一个可以使用 Selenium Webdriver 函数修复的解决方案,即使我主要使用的是 Splinter。

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

两者似乎都不起作用。

有谁知道如何正确地做到这一点?如果您需要更多信息,请告诉我。感谢您的帮助。

【问题讨论】:

    标签: splinter


    【解决方案1】:

    硒被driver浏览器属性暴露:

    >>> from splinter import Browser
    b>>> b = Browser()
    >>> b.driver
    <selenium.webdriver.firefox.webdriver.WebDriver (session="e607ceaa-2c63-435e-9991-432376102bf5")>
    >>> 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-09-17
      • 1970-01-01
      • 1970-01-01
      • 2018-03-13
      • 2017-11-04
      • 1970-01-01
      • 2022-12-14
      • 2020-01-12
      相关资源
      最近更新 更多