相关疑难解决方法(0)

我该如何重新连接WebDriver使用Selenium打开的浏览器?

由于某些未知原因,我的浏览器非常缓慢地打开了远程服务器的测试页。因此,我在考虑是否可以在退出脚本后重新连接到浏览器,但不执行webdriver.quit()此操作将使浏览器保持打开状态。这可能是HOOK或Webdriver句柄。我查找了硒API文档,但未找到任何功能。我正在使用Chrome 62,x64,Windows 7,硒3.8.0。能否解决这个问题,我将不胜感激。

session selenium webdriver python-3.x selenium-webdriver

9
推荐指数
2
解决办法
5874
查看次数

Python Selenium Webdriver - 动态更改下载目录

要在定义 selenium webdriver 之前明确定义下载目录,我们使用以下代码:

chromeOptions = webdriver.ChromeOptions()
prefs = {"download.default_directory" : "C:/data/cline"}
chromeOptions.add_experimental_option("prefs",prefs)
chromePath = "path to chromedriver"

driver = selenium.webdriver.chrome.webdriver.WebDriver(executable_path=chromePath, port=0,    chrome_options=chromeOptions, service_args=None, desired_capabilities=None,   service_log_path=None)
Run Code Online (Sandbox Code Playgroud)

我想下载许多文件,每个文件都到一个不同的(新创建的)目录。定义驱动后是否可以更改下载目录?

python selenium

7
推荐指数
1
解决办法
5067
查看次数

如何在同一会话中将 selenium webdriver 从无头模式设置为正常模式?

将 selenium webdriver 设置为无头模式后是否可以将其设置回正常模式?

from selenium import webdriver
from selenium.webdriver.firefox.options import Options

options = Options()
options.headless = True
driver = webdriver.Firefox(options=options)
driver.get(http://stackoverflow.com)

# set driver back to normal mode
Run Code Online (Sandbox Code Playgroud)

python selenium-chromedriver selenium-firefoxdriver google-chrome-headless firefox-headless

5
推荐指数
1
解决办法
3784
查看次数