Python 将selenium驱动程序连接到嵌入在应用程序中的浏览器
我想使用SeleniumWebDriver在嵌入到应用程序中的浏览器中运行自动测试 我这样写代码:Python 将selenium驱动程序连接到嵌入在应用程序中的浏览器,python,selenium,Python,Selenium,我想使用SeleniumWebDriver在嵌入到应用程序中的浏览器中运行自动测试 我这样写代码: from selenium import webdriver from selenium.webdriver.chrome.options import Options import time TOOL_LOCATION = r"C:\my_app\app.exe" chrome_options = Options() chrome_options.binary_location = TOOL
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import time
TOOL_LOCATION = r"C:\my_app\app.exe"
chrome_options = Options()
chrome_options.binary_location = TOOL_LOCATION
driver = webdriver.Remote(command_executor='http://test-dev:4444/wd/hub',
desired_capabilities=chrome_options.to_capabilities())
driver.find_element_by_name("input")
time.sleep(1)
driver.close()
当我开始测试时,出现以下错误:
selenium.common.exceptions.WebDriverException: Message: unknown error: DevToolsActivePort file doesn't exist
如何解决此问题?首先检查浏览器版本和chromedriver版本 或者, 您需要将--disable dev shm usage添加到默认启动标志中。检查url [但是,根据Add--disable dev shm usage to default launch flags,添加参数--disable dev shm usage将暂时解决问题。] 网址: