【问题标题】:Python script to test CEF3 embedded application using selenium/chromedriver - cannot connect to chrome at 127.0.0.1:4444使用 selenium/chromedriver 测试 CEF3 嵌入式应用程序的 Python 脚本 - 无法在 127.0.0.1:4444 连接到 chrome
【发布时间】:2016-01-05 15:49:54
【问题描述】:

该应用程序是一个嵌入式 CEF3 C# MS Windows 应用程序,它已启用远程调试器地址。我遵循了 java 示例,我可以使用 java prg 控制应用程序。然而,我们使用 Python 作为主要的测试自动化语言,我尝试在 Python 中实现相同的代码,但我得到“cannot connect to chrome at 127.0.0.1:4444”。 我在这里想念什么:

import selenium
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
import time
import os

os.environ["webdriver.chrome.driver"] = "D:/dev/desktop-automation/selenium/chromedriver.exe"
chromeOps = webdriver.ChromeOptions()
chromeOps.binary_location = "C:/Program Files (x86)/Path to application/Application.exe"
chromeOps.debugger_address = "127.0.0.1:4444"
browser = webdriver.Chrome(chrome_options=chromeOps)

time.sleep(3)
browser.get("http://example.com")

非常感谢您的帮助!

【问题讨论】:

    标签: python selenium selenium-chromedriver chromium-embedded


    【解决方案1】:

    缺少的一点是在运行脚本之前设置此值: 设置 webdriver.chrome.driver="D:/dev/desktop-automation/selenium/chromedriver.exe" os.environ好像没有给运行脚本设置这个值。

    【讨论】:

      猜你喜欢
      • 2018-04-29
      • 2022-07-18
      • 1970-01-01
      • 2014-07-16
      • 1970-01-01
      • 2020-02-12
      • 1970-01-01
      • 1970-01-01
      • 2022-07-31
      相关资源
      最近更新 更多