【发布时间】:2021-08-27 14:56:07
【问题描述】:
我正在尝试控制现有的 chrome 浏览器,并希望使用相同的浏览器进行自动化,使用 selenium 和空手道。
这是一个实际的场景:
我从桌面单击一个超链接,它会在 chrome 浏览器中打开。现在我需要在同一个浏览器中运行我的自动化脚本。
我有以下代码,在此之前,我正在使用此链接https://harith-sankalpa.medium.com/connect-selenium-driver-to-an-existing-chrome-browser-instance-41435b67affd以调试模式启动chrome浏览器
* def startUrl = "https://google.com"
* def browser = "chrome"
* def type = "chromedriver"
* def executable = "C:/chromedriver/" + type + ".exe"
* def driverConfig = { type: #(type), showDriverLog: true, start:false, executable: #
(executable), webDriverSession: { desiredCapabilities: { browserName: #
(browser),goog:chromeOptions": { debuggerAddress: 127.0.0.1:9223 } } } }
* configure driver = driverConfig
Given driver startUrl
* waitFor('input[name=q]')
And input('input[name=q]', 'Youtube')
谁能确认它是如何完成的?我是空手道用户界面的新手
【问题讨论】:
标签: karate