655得票19回答
使用Python的Selenium WebDriver获取WebElement的HTML源代码

我正在使用Python绑定来运行Selenium WebDriver:from selenium import webdriver wd = webdriver.Firefox() 我知道可以这样获取一个网页元素:elem = wd.find_element_by_css_selector('...

376得票35回答
错误信息:在路径中需要可用的“chromedriver”可执行文件。

我正在使用Python的Selenium,并从这个网站http://chromedriver.storage.googleapis.com/index.html?path=2.15/下载了适用于我的Windows电脑的ChromeDriver。 下载完ZIP文件后,我将其解压到了我的下载文件...

354得票50回答
WebDriverException:未知错误:尝试启动Chrome浏览器时DevToolsActivePort文件不存在。

我正在尝试使用URL启动Chrome浏览器,浏览器会启动,但之后没有任何反应。 1分钟后,我看到以下错误信息: Unable to open browser with url: 'https://www.google.com' (Root cause: org.openqa.seleniu...

330得票18回答
如何使用Python和Selenium选择下拉菜单的值?

我需要从一个下拉菜单中选择一个元素。 例如:<select id="fruits01" class="select" name="fruits"> <option value="0">Choose your fruits:</option> &lt...

301得票48回答
224得票18回答
Selenium WebDriver可以在后台默默打开浏览器窗口吗?

我有一个Selenium测试套件,运行多个测试。在每个新的测试中,它会打开一个浏览器窗口,覆盖在我已经打开的任何其他窗口之上。在本地环境中工作时非常不舒服。是否有一种方法可以告诉Selenium或操作系统(Mac)将窗口在后台打开?

215得票29回答
Selenium C# WebDriver: 等待元素出现

在webdriver开始执行操作之前,我想确保一个元素存在。 我试图让类似下面这样的东西工作:WebDriverWait wait = new WebDriverWait(driver, new TimeSpan(0, 0, 5)); wait.Until(By.Id("login&...

204得票13回答
如何使用Python + Selenium WebDriver保存和加载cookies

我应该如何将Python的Selenium WebDriver中的所有cookies保存到.txt文件中,然后稍后再加载它们? 文档对getCookies函数没有详细说明。

190得票10回答
如何使用Selenium WebDriver检查元素是否存在?

如何使用Web Driver检查元素是否存在? 使用try-catch是唯一可能的方式吗?boolean present; try { driver.findElement(By.id("logoutLink")); present = true; } catc...

182得票13回答
使用WebDriver在等待特定条件时刷新Web页面

我正在寻找一种更优雅的方式在测试期间刷新网页(我使用Selenium2)。 我只是发送F5键,但我想知道driver是否有刷新整个网页的方法。 以下是我的代码 while(driver.findElements(By.xpath("//*[text() = 'READY']")).siz...