【通过Selenium和python切换到iframe】教程文章相关的互联网学习教程文章

python-等待,直到在Selenium WebDriver中单击按钮以单击下一个按钮?【代码】

我正要在程序中单击浏览器中的一个按钮,然后在该页面中应显示另一个按钮.该按钮出现后,我的程序将立即运行下一步操作,以单击下一步按钮.我目前收到此错误:ElementNotVisibleException: Message: element not visible因此,我假设我正在调用该操作以在该按钮出现之前单击下一个按钮.我的问题是我该如何做才能让程序等到可以单击按钮,再单击按钮?driver.find_element_by_xpath('//*[@id="add-remove-buttons"]/input').click() driv...

javascript-如何使用Selenium和Python将文本插入div节点【代码】

我想使用硒将文本放入div()中.我使用python并将javascript插入我的代码中.这是我的代码:js="document.getElementsByClassName(\"inputPanel\")[0].innerText=\"hello!\";"但这提醒我有一个错误:selenium.common.exceptions.WebDriverException: Message: unknown error: Cannot set property 'innerText' of undefined我怎么解决这个问题?如果可以的话,我将不胜感激!解决方法:要将字符序列插入< div>中,节点,您可以使用以下解决...

python-Selenium Webdriver无需制作PC服务器【代码】

我已阅读以下有关此问题的评论:What are the differences between ‘Selenium-server-standalone.jar’ and ‘Selenium Client & WebDriver’? 我想问:没有服务器就可以单独运行webdriver吗?我仅使用“ pip install selenium”安装selenium,并从chrome网站下载了chrome webdriver. 如果我运行这样的代码:from selenium import webdriver from selenium.webdriver.common.keys import Keysdriver = webdriver.Firefox() driver....

python-selenium.common.exceptions.WebDriverException:消息:“ geckodriver”可执行文件必须与GeckoDriver Selenium F【代码】

我不了解Pycharm-或Python足够好以解决问题所在.在我看来,似乎应该执行这些简单的代码,但我却看到一堆乱七八糟的文字,对我什么也没说. 使用Selenium的其他人会收到此错误,知道如何解决吗?物理代码-"C:\Users\Noah Linton\PycharmProjects\EdgenuityBot\venv\Scripts\python.exe" "C:/Users/Noah Linton/PycharmProjects/EdgenuityBot/Edgenuity Bot" Traceback (most recent call last):File "C:\Users\Noah Linton\PycharmProje...

selenium+python+unittest实现自动化测试(入门篇)【图】

本文主要讲解关于selenium自动化测试框架的入门知识点,教大家如何搭建selenium自动化测试环境,如何用selenium+python+unittest实现web页面的自动化测试,先来看看selenium、unittest是什么。一、selenium、unittest概念 Selenium 是用于测试 Web 应用程序用户界面 (UI) 的常用框架。它是一款用于运行端到端功能测试的超强工具。您可以使用多个编程语言编写测试,并且 Selenium 能够在一个或多个浏览器中执行这些测试,同时支持所...

selenium.common.exceptions.InvalidSessionIdException使用GeckoDriver通过Python在无头模式下使用Selenium Firefox【代码】

我正在尝试使用python和硒在Firefox的无头模式下自动执行某些情况.我想,我做了我需要的所有设置,但webdrvier尚未初始化. 我的问题是在执行我的代码后大约30-60秒钟出现了异常,并且异常消息不清楚,实际上消息部分为空.如您所见,在无头模式下运行的geckodriver.log firefox. 我使用Firefox 56.0.1,python 3.6,硒3.141.0.这是我的代码和日志; 码:import os import time import selenium from selenium import webdriver from seleni...

python-Selenium ChromeDriver-driver.quit()上的HTTP 407【代码】

我在代理服务器后面.使用Selenium 2.39,Python 2.7.6和ChromeDriver 2.9,每当我在Chrome实例上调用.quit()时,都会收到HTTP 407错误.使用FirefoxDriver时,不会发生此类错误.Traceback (most recent call last): File "C:\Users\Tetrinity\Desktop\chrometest.py", line 7, in <module>browser.quit()File "C:\Python27\lib\site-packages\selenium-2.39.0-py2.7.egg\selenium\webdriver\chrome\webdriver.py", line 82, in quitself...

Python Selenium:查找h1元素,但返回空文本字符串【代码】

我正在尝试在此page的标题中获取文本:iShares FTSE MIB UCITS ETF EUR (Dist) 标签如下所示:<h1 class="product-title" title="iShares FTSE MIB UCITS ETF EUR (Dist)"> iShares FTSE MIB UCITS ETF EUR (Dist) </h1>我正在使用此xPath:xp_name = ".//*[@class[contains(normalize-space(.), 'product-title')]]"在Selenium WebDriver for Python中通过.text检索:new_name = driver.find_element_by_xpath(xp_name).text驱动程...

Python-在私有模式下使用Selenium启动firefox【代码】

这个问题已经在这里有了答案: > Python/Selenium incognito/private mode 7个我有以下脚本:#!/usr/bin/python3 from selenium import webdriver import timedef getProfile():profile = webdriver.FirefoxProfile()profile.set_preference("browser.privatebrowsing.autostart", True)return profiledef main():browser = webdriver.Firefox(firefox_profile=getProfi...

是否可以在不安装Python的情况下为RobotFramework安装Selenium2Library?

如果我只有Jython,可以使用Selenium2Library吗?也就是说,我还没有安装Python,并且希望摆脱不需要它的麻烦.我已经阅读了有冲突的信息,但是jybot无法使用selenium2library,我将需要pybot来使用它. 如果jybot无法使用selenium2Library,有没有办法让jybot以某种方式调用pybot? 谢谢解决方法:因此,经过一些阅读和反复试验后,可以将Selenium2Library仅与Jython AS一起使用,因为您使用的是jython 2.7 … jython 2.5.x与Selenium2Library...

在Python中使用Selenium提取JavaScript生成的HTML?萤火虫?【代码】

Python noobie在这里. 我有一个数据收集问题.我在此网站上,当我检查Firebug所需的元素时,它会显示包含所需信息的来源.但是,常规源代码(没有Firebug)不会提供此信息.这意味着我也无法通过普通的硒HTML抓取来获取数据. 我想知道是否有一种方法可以像Firebug一样捕获硒数据-我猜这是在页面加载javascript或jquery之后生成的HTML. 这是一张图片:http://i.imgur.com/CXLOHYx.png 您可以看到我想要的信息是“灰色”的,这与大多数其他HTM...

尝试使用Selenium Python时出现NoSuchElementException【代码】

尝试使用Selenium在python中查找元素时,我不断收到NoSuchElementException.我正在等待页面完全加载,并且正在切换到正确的框架(或者至少我认为是!). 这是代码:driver.get("https://www.arcgis.com/home/signin.html") driver.implicitly_wait(10)driver.switch_to_frame("oAuthFrame") elem = driver.find_element_by_name('username') elem1 = driver.find_element_by_name('password')这是我要访问的网页部分:<input id="user_...

如何使用Selenium – Python选择下拉菜单选项值【代码】

我需要从下面的下拉菜单中选择一个元素.<select class="chosen" id="fruitType" name="fruitType"><option value="">Select</option><option value="1">jumbo fruit 1</option><option value="2">jumbo fruit 2</option><option value="3">jumbo fruit 3</option><option value="4">jumbo fruit 4</option><option value="5">jumbo fruit 5</option><option value="8">jumbo fruit 6</option> </select>我试过用这个代码,driver = ...

python – Selenium打开本地文件【代码】

我试图使用Firefox / Selenium实例作为图像的基本幻灯片.我的想法是,我将从本地目录中打开webdriver和driver.get()文件. 当我运行以下操作时,收到错误:selenium.common.exceptions.WebDriverException:消息:尝试在不建立连接的情况下运行命令 我的假设是selenium正在尝试测试下一个driver.get()请求并且不允许本地的,非网络连接的连接是否有办法绕过这种行为?我的代码示例如下所示:from selenium import webdriver import tim...

Selenium文件上传使文件选择器窗口打开(OS / X和Python)【代码】

我可以使用Selenium将文件上传到远程服务器,但即使上传文件,文件选择器对话框也会存在. The Selenium FAQ notes that,“你不能直接与原生操作系统文件浏览器对话框进行交互,但是我们做了一些魔术……”鉴于在这里使用“魔法”,我得到的行为有点粗糙并不奇怪边缘.但似乎有解决方法.从this answer开始,我有以下代码:import contextlib, time from selenium import webdriver import selenium.webdriver.common.action_chains as act...