I'm doing web scraping using selenium.I have encountered an issue.
Python version 3.9.7, window 10
Code:
url=['https://www.tradingview.com/markets/stocks-usa/market-movers-large-cap/']
catergories=['Overview','Xperformance','Valuation','Dividends','Margins','Income Statement','Balance Sheet','Oscillator','Trend-Following']
user_agent= 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:87.0)Gecko/20100101 Firefox/87.0'
FireFoxDriverPath = os.path.join(os.getcwd(),'Drivers','Geckodriver.exe')
FireFoxProfile = webdriver.FirefoxProfile()
FireFoxProfile.set_preference("general.useragent.override",user_agent)
browser = webdriver.Firefox(executable_path=FireFoxDriverPath)
browser.implicitly_wait(7)
url= 'https://www.tradingview.com/markets/stocks-usa/market-movers-large-cap/'
browser.get(url)
Error:
module 'selenium.webdriver' has no attribute 'firefoxprofile'
These the new error i got after i change the FirefoxProfile() Message: 'Geckodriver.exe' executable needs to be in PATH.
to able to use
FirefoxProfile
You could do
and
set_preference
like below: