Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Selenium won't open a link
#2
(Apr-07-2020, 03:51 AM)Justin2444 Wrote: selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please se
Bye this mean that chromedriver.exe must be in Environment Variables Path.
Driver can also be in same folder as you run script,that will also work.
Here a typical setup where set executable_path and options(where can eg set headless).
So C:\cmder\bin folder is in my Windows Path.
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
from bs4 import BeautifulSoup
import time

#--| Setup
options = Options()
options.add_argument("--headless")
options.add_argument('--disable-gpu')
options.add_argument('--log-level=3')
browser = webdriver.Chrome(executable_path=r'C:\cmder\bin\chromedriver.exe', options=options)
#--| Parse or automation
browser.get('https://www.morningstar.com/stocks/XOSL/XXL/quote.html')
time.sleep(1)
soup = BeautifulSoup(browser.page_source, 'lxml')
price_sales = soup.select('li:nth-child(9) > div > div.dp-value.ng-binding')
print(price_sales[0].text.strip())
Output:
0.13
Reply


Messages In This Thread
Selenium won't open a link - by Justin2444 - Apr-07-2020, 03:51 AM
RE: Selenium won't open a link - by snippsat - Apr-07-2020, 06:44 AM
RE: Selenium won't open a link - by Larz60+ - Apr-07-2020, 09:46 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  get link and link text from table metulburr 5 6,376 Jun-13-2019, 07:50 PM
Last Post: snippsat
  Firefox Selenium (open new tab) oneclick 1 7,820 Dec-29-2018, 06:59 AM
Last Post: hbknjr
  open a web page by selenium !! evilcode1 3 3,392 Aug-01-2018, 03:05 PM
Last Post: snippsat
  Error in Selenium: CRITICAL:root:Selenium module is not installed...Exiting program. AcszE 1 3,673 Nov-03-2017, 08:41 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

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