Advertisement
Temidayo12

Firefox 2

Jan 13th, 2023 (edited)
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.61 KB | None | 0 0
  1. #code snippet 2
  2. from selenium import webdriver
  3. from selenium.webdriver.firefox.options import Options
  4.  
  5. # the target website
  6. url = "https://scrapeme.live/"
  7.  
  8. #the interface for turning on headless mode
  9. options = Options()
  10. options.add_argument("-headless")
  11.  
  12. #using Firefox headless webdriver to secure connection to Firefox
  13. with webdriver.Firefox(options=options) as driver:
  14.    
  15.     #opening the target website in the browser
  16.     driver.get(url)
  17.    
  18.     #printing the target website url and title
  19.     print(driver.current_url)    #https://scrapeme.live/shop/
  20.     print(driver.title) #Products - ScrapeMe
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement