[英]Selenium Remote Webdriver with remote profile
是否可以在服務器中使用特定的遠程配置文件(非臨時)打開 Selenium Remote Webdriver?
我只能從客戶端傳遞browser_profile
。 如果我在沒有browser_profile
的情況下實例化類,Selenium 在服務器中創建一個新的臨時配置文件。
from selenium import webdriver
class Remote(webdriver.Remote):
def __init__(self, **kwargs):
capabilities = {_**whatever_}
super().__init__(
command_executor='http://HOST:PORT/wd/hub',
desired_capabilities=capabilities.copy(),
browser_profile=webdriver.FirefoxProfile(_what?_)
)
這是我要找的:
fp = webdriver.FirefoxProfile()
fp.set_preference("browser.startup.homepage_override.mstone", "ignore")
fp.set_preference("focusmanager.testmode", True)
fp.update_preferences()
driver = webdriver.Remote(
command_executor='http://127.0.0.1:4444/wd/hub',
desired_capabilities={'browserName': 'firefox', 'javascriptEnabled': True},
browser_profile=fp
)
參考:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.