草庐IT

Webdriver-manager

全部标签

Python 将 Adblock 与 Selenium 和 Firefox Webdriver 结合使用

我的目标是通过Python将AdblockPlus与Selenium结合使用。我已经能够让它加载扩展,但默认情况下它不包含默认过滤器“EasyList”。这是我目前所拥有的:fromseleniumimportwebdriverfromtimeimportsleepffprofile=webdriver.FirefoxProfile()adblockfile='/Users/username/Downloads/adblock_plus-2.4-tb+fx+an+sm.xpi'ffprofile.add_extension(adblockfile)ffprofile.set_prefe

Python Selenium 异常 AttributeError : "' Service' object has no attribute 'process' "in selenium. webdriver.ie.service.Service

我有一个SeleniumPython测试套件。它开始运行,但几分钟后抛出以下错误:ExceptionAttributeError:"'Service'objecthasnoattribute'process'"in>ignored我的测试套件实现是:importunittestfromHTMLTestRunner2importHTMLTestRunnerimportosimportRegression_TestCase.RegressionProject_TestCase2#getthedirectorypathtooutputreportfile#result_dir=os.getc

python - 有没有人用过Webdriver的ActionChains(python绑定(bind))?

我正在尝试使用ActionChains中的move_to_element触发鼠标悬停事件,但无法正常工作。任何帮助表示赞赏。谢谢。 最佳答案 fromselenium.webdriver.common.action_chainsimportActionChainsActionChains(drivers).move_to_element(drivers.find_element_by_id('element_id')).click().perform()如果你想选择任何值,menu1=drivers.find_element_by_

python - 如何使用带有 Python 的 Selenium WebDriver 获取选定的选项?

如何使用带有Python的SeleniumWebDriver获取选定的选项:有人对getFirstSelectedOption有解决方案吗?我正在使用它来获取选择元素:try:FCSelect=driver.find_element_by_id('FCenter')self.TestEventLog=self.TestEventLog+"VerifyFormElements:FCenterSelectfound"exceptNoSuchElementException:self.TestEventLog=self.TestEventLog+"Error:SelectFCenterele

python - 哪个是最pythonic : installing python modules via a package manager ( macports, apt)或通过pip/easy_install/setuptools

通常我倾向于通过包管理器安装东西,用于unixy的东西。然而,当我编写大量perl程序时,我会使用CPAN、更新版本等等。一般来说,我过去常常通过包管理器安装系统的东西,通过它自己的包管理器(gem/easy_install|pip/cpan)安装语言的东西现在主要使用python,我想知道最佳实践是什么? 最佳答案 系统python版本及其库经常被发行版中的软件使用。只要您使用的软件对与您的发行版相同的python版本和所有库感到满意,那么使用发行包就可以正常工作。然而,您经常需要软件包的开发版本,或更新版本,或旧版本。然后它就不

python - Satchmo 克隆satchmo.py ImportError : cannot import name execute_manager

我让satchmo尝试,但我在第一次尝试时遇到了一个很大的问题,我不明白哪里出了问题。当我将$pythonclonesatchmo.py制作成清晰的django项目时,它会报错:$pythonclonesatchmo.pyCreatingtheSatchmoApplicationCustomizingthefilesPerforminginitialdatasynchingTraceback(mostrecentcalllast):File"manage.py",line18,infromdjango.core.managementimportexecute_managerImport

python - 使用 PhantomJS 运行 Selenium Webdriver 时出现 InvalidElementStateException

我正在运行在Firefox中运行正常的selenium测试,但在使用PhantomJS时出现错误。这是我的python代码:driver.find_element_by_link_text("AddProvince").click()driver.find_element_by_id("id_name").clear()driver.find_element_by_id("id_name").send_keys("Frosinone")driver.find_element_by_id("id_code").clear()driver.find_element_by_id("id_co

python - 使用 Tk Grid Geometry Manager 的 GUI 布局

使用Python构建一个供个人使用的小型应用程序,我想尝试使用Tkinter进行一些GUI编程。这是我到目前为止创建的GUI:应用疑惑:如何确保屏幕截图中的三个LableFrames(A、B和C)具有相同的宽度?(或者更确切地说,宽度等于三个中最宽的?例如,在屏幕截图中,A是最宽的,我希望B和C也一样宽-直到D行)。(它不必动态计算-如果我能确保第一次编码时宽度相同就足够了。它们不需要在运行时更改。)TkGridGeometryManager疑惑:当您使用框架时,网格(行、列)是仅针对框架的大小特定的,还是根据窗体(根窗口)的大小计算的?如何确定网格中列的大小?我还没有完全理解“权重”

python - Selenium 安装 Marionette webdriver

我的firefox版本47有这个问题https://github.com/seleniumhq/selenium/issues/2110因此,我尝试添加Marionette网络驱动程序来修复它:https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver但是:fromselenium.webdriver.common.desired_capabilitiesimportDesiredCapabilitiesfirefox_capabilities=DesiredCapabilities.FIREFOXf

python - Selenium webdriver 和 unicode

这是我使用Selenium2库的第二天,Unicode带来的痛苦似乎从未消退。我只是做最基本的操作,想打印页面源码:fromseleniumimportwebdriverdriver=webdriver.Firefox()driver.get("http://google.com")printdriver.page_source果然报错了:UnicodeEncodeError:'ascii'codeccan'tencodecharacteru'\u0119'inposition62045:ordinalnotinrange(128)我怎样才能将其编码为utf-8?