怎么利用 ChromeDriver 和 Selenium对 CEF应用进行自动化测试-python实现

简介: 怎么利用 ChromeDriver 和 Selenium对 CEF应用进行自动化测试-python实现

In my cefpython application I specify a remote debug port:

switches = {"remote-debugging-port": "22222"}
 cefpython.Initialize(settings, switches)

Run chromedriver:

chromedriver --port=33333

I’m using selenium python bindings:

from selenium import webdriver
 chromeOptions = {'debuggerAddress':'192.168.1.42:22223'}
 capabilities = {'chromeOptions':chromeOptions}
 browser = webdriver.Remote('http://127.0.0.1:33333' capabilities)
 browser.get("http://www.google.com"

I wanted chromedriver and selenium on a remote machine so used an ssh tunnel on

the client:


ssh -L 0.0.0.0:22223:localhost:22222 localhost

A nice bonus is that in chrome I can access “192.168.1.42:22223” and can use

the chrome dev tools on the open tabs in my remote browser.


P.S. If you don’t want to specify the port you need to add the

“–remote-debugging-port” chromedriver supplies your app to the switches

dictionary. Also in the selenium script:


options = webdriver.ChromeOptions()
 options.binary_location = "/path/to/app"
 browser = webdriver.Chrome(chrome_options=options)


相关文章
|
21小时前
|
分布式计算 调度 异构计算
Python 数学应用(四)(4)
Python 数学应用(四)
10 4
|
21小时前
|
消息中间件 Kafka Python
Python 数学应用(四)(3)
Python 数学应用(四)
19 5
|
21小时前
|
存储 传感器 数据可视化
Python 数学应用(四)(2)
Python 数学应用(四)
4 0
Python 数学应用(四)(2)
|
21小时前
|
存储 消息中间件 Kafka
Python 数学应用(四)(1)
Python 数学应用(四)
9 2
|
21小时前
|
机器学习/深度学习 存储 算法
Python 数学应用(三)(4)
Python 数学应用(三)
7 2
|
21小时前
|
存储 算法 决策智能
Python 数学应用(三)(3)
Python 数学应用(三)
9 2
Python 数学应用(三)(3)
|
21小时前
|
存储 资源调度 算法
Python 数学应用(三)(2)
Python 数学应用(三)
9 1
|
21小时前
|
存储 机器学习/深度学习 前端开发
Python 数学应用(三)(1)
Python 数学应用(三)
10 2
|
22小时前
|
存储 算法 数据挖掘
Python 数学应用(二)(3)
Python 数学应用(二)
9 2
|
22小时前
|
存储 数据可视化 算法
Python 数学应用(二)(2)
Python 数学应用(二)
10 1