如何在selenium中打开现有的opera实例

时间:2018-02-03 13:19:41

标签: python selenium selenium-webdriver opera

我正在尝试在用户登录时为会话分配唯一​​标识符的网站上使用BeautifulSoup(例如d83c231c-a1a0-4b9b-85bb-7cc36aa6b66c)以及“序列号”:serial:"ABzepITkLfRuQ+4hCMTXfA。< / p>

通过WebDriver进行检查时,如果我使用WebDriver,每次登录网站时,我都会收到新生成的guid和序列号。有没有办法以编程方式打开相同的浏览器实例,以便每次都显示为与网站相同的guid?

这就是我现在用来打开浏览器的内容:

import time
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.chrome import service
from selenium.webdriver.support.ui import WebDriverWait
import pprint

webdriver_service = service.Service('operadriver')
webdriver_service.start()
options = webdriver.ChromeOptions()
options.binary_location = "C:\Program Files (x86)\Opera\launcher.exe"
driver = webdriver.Opera(opera_options=options) # success!

driver.get('http://somesite.com')

0 个答案:

没有答案