Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/329.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 将selenium驱动程序连接到嵌入在应用程序中的浏览器_Python_Selenium - Fatal编程技术网

Python 将selenium驱动程序连接到嵌入在应用程序中的浏览器

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

我想使用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_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将暂时解决问题。]

网址: