Selenium 连接一个已有的连接
帮朋友弄个东西,需要先登录,有一个不复杂的验证码,但是上OCR也太重,所以就先起一个driver,然后手工登录之后再连过来进行操作.
- 先启动一个Driver和Session,并且打印出连接的URL和Session
url = driver.command_executor._url #"http://127.0.0.1:60622/hub"
session_id = driver.session_id #'4e167f26-dc1d-4f51-a207-f761eaf73c31'
- 然后再连接过去
driver = webdriver.Remote(command_executor=url,desired_capabilities={})
driver.session_id = session_id
REF:
Last modified on 2016-11-07