试图让Firefox与Selenium一起使用 [英] Trying to get Firefox working with Selenium
本文介绍了试图让Firefox与Selenium一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在处理下面的代码,很奇怪的是它一直在打开Chrome浏览器而不是Firefox浏览器.
I am playing around with the code below, and the weird thing is that it keeps opening a Chrome browser instead of a Firefox browser.
import requests
import selenium
from selenium import webdriver
from bs4 import BeautifulSoup
from webbot import Browser
driver = webdriver.Firefox(executable_path= r'C:/path_here/geckodriver.exe')
web = Browser()
url = 'https://web_browser'
web.go_to(url)
# 1st validation
web.type('email_address' , into='username')
web.click('Continue')
# password
web.type('passwd' , into='password')
web.click('Next')
我从下面的链接中获得了geckodriver,并将扩展名从.gz更改为.exe,我认为这是正确的,但我不确定..
I got the geckodriver from the link below, and I change the extension from .gz to .exe, which I think is correct, but I'm not totally sure..
https://github.com/mozilla/geckodriver/releases
推荐答案
这最终对我有用.
from selenium import webdriver
profile = webdriver.FirefoxProfile()
profile.accept_untrusted_certs = True
wd = webdriver.Firefox(executable_path="C:/Utility/geckodriver.exe", firefox_profile=profile)
url = "https://www.google.com/"
wd.get(url)
# download geckodriver for windows 64-bit from here
# https://github.com/mozilla/geckodriver/releases
这篇关于试图让Firefox与Selenium一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文