我想自动执行以下Linux shell命令:
google-chrome-stable --password-store=basic --user-data-dir=/tmp/chrome使用splinter (或selenium),但我找不到解释如何将参数和值传递给Browser命令的文档/示例。
下面(错误的)代码显示了我尝试过的内容:
"""
google-chrome-stable --password-store=basic --user-data-dir=/tmp/chrome
"""
from splinter import Browser
from selenium import webdriver
chrome_options = webdriver.ChromeOptions()
chrome_options.add_experimental_option("password-store", "basic")
chrome_options.add_experimental_option("user-data-dir", "/tmp/chrome")
browser = Browser('chrome', options=chrome_options)你能帮助正确的语法吗?
发布于 2020-10-08 01:35:49
它是这样做的:
from splinter import Browser
import selenium.common.exceptions
from selenium import webdriver
def prepare_special_chrome():
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--password-store=basic")
chrome_options.add_argument("--user-data-dir=/tmp/chrome")
browser = Browser('chrome', options=chrome_options)
browser.visit('https://machine.local/#/')
if __name__ == "__main__":
prepare_special_chrome()https://stackoverflow.com/questions/64234026
复制相似问题