selenium webdriver 中 firefox 的无头模式没有响应
headless mode on firefox in selenium webdriver does not respond
伙计们,我想在 Firefox 中以无头模式打开引用,我有一个非常简单的代码,但它不起作用,当我按 运行 时,它什么也没显示。
我的代码是:
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
web = "https://www.powerplay.com/sportsbook/SOCCER/"
firefox_options = Options()
firefox_options.headless = True
driver = webdriver.Firefox(options=firefox_options)
driver.get(web)
这是我得到的回复:
以下适合我:
executablePath = r'C:\geckodriver.exe'
options = webdriver.FirefoxOptions()
options.add_argument("--headless")
driver = webdriver.Firefox(executable_path = executablePath, options=options)
driver.maximize_window()
driver.get("https://www.powerplay.com/sportsbook/SOCCER/")
print(driver.title)
O/P :
Soccer Betting | Predictions, Tips & Odds | PowerPlay Canada
Process finished with exit code 0
伙计们,我想在 Firefox 中以无头模式打开引用,我有一个非常简单的代码,但它不起作用,当我按 运行 时,它什么也没显示。 我的代码是:
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
web = "https://www.powerplay.com/sportsbook/SOCCER/"
firefox_options = Options()
firefox_options.headless = True
driver = webdriver.Firefox(options=firefox_options)
driver.get(web)
这是我得到的回复:
以下适合我:
executablePath = r'C:\geckodriver.exe'
options = webdriver.FirefoxOptions()
options.add_argument("--headless")
driver = webdriver.Firefox(executable_path = executablePath, options=options)
driver.maximize_window()
driver.get("https://www.powerplay.com/sportsbook/SOCCER/")
print(driver.title)
O/P :
Soccer Betting | Predictions, Tips & Odds | PowerPlay Canada
Process finished with exit code 0