Python Forum
How to geckodriver anonymous firefox
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to geckodriver anonymous firefox
#2
I guess you mean headless as it called.
from selenium.webdriver.firefox.options import Options

#-- Setup
options = Options()
options.add_argument("--headless")
browser = webdriver.Firefox(firefox_options=options, executable_path=r"path to geckodriver")
#-- Parse
browser.get('url')
title = browser.find_element_by_xpath('//title')
print(t.text)
#browser.quit()
So code over use selenium to parse,if use BeautifulSoup to parse you send code from selenium,you don't use urlopen(url),
but browser.page_source.
Otherwise there is no point to use Selenium(which should be used if need eg JavaScript,otherwise not).
# Give source code to BeautifulSoup
soup = BeautifulSoup(browser.page_source, 'lxml')
welcome = soup.select('head > title')
print(welcome.text) 
Reply


Messages In This Thread
RE: How to geckodriver anonymous firefox - by snippsat - Feb-10-2018, 07:04 PM
RE: How to geckodriver anonymous firefox - by wavic - Feb-10-2018, 08:54 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Need help for script access via webdriver to an open web page in Firefox Clixmaster 1 1,413 Apr-20-2023, 05:27 PM
Last Post: farshid
  Connect to existing Firefox session with Selenium euras 0 5,658 Feb-11-2021, 02:54 PM
Last Post: euras
  Selenium error with ebdriver (geckodriver) Martinelli 4 4,896 Sep-24-2019, 01:40 AM
Last Post: Martinelli
  Unable to access javaScript generated data with selenium and headless FireFox. pjn4 0 2,644 Aug-04-2019, 11:10 AM
Last Post: pjn4
  Firefox Selenium (open new tab) oneclick 1 7,892 Dec-29-2018, 06:59 AM
Last Post: hbknjr
  selenium not running firefox Sanlus 5 5,086 Aug-31-2018, 10:37 PM
Last Post: snippsat
  Selenium with headless firefox is slow mgtheboss 4 15,183 Jan-13-2018, 09:03 PM
Last Post: metulburr
  Getting error 'geckodriver' executable needs to be in PATH. sumandas89 2 37,730 Jan-11-2018, 07:54 AM
Last Post: sumandas89

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020