Answer the question
In order to leave comments, you need to log in
How to follow a link without getting access denied Python + Selenium?
I'm trying to follow a link using selenium + python but it gives me an "access denied" error, what should I do about it and how can I get around it?
Website: https://www.nseindia.com/
When you hover over Market Data, you need to click on Pre-Open Market
My code:
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.common.action_chains import ActionChains
import time
options = Options()
driver = webdriver.Firefox(options=options)
driver.get("https://www.nseindia.com/")
element_to_hover_over = driver.find_element_by_xpath("/html/body/header/nav/div[2]/div/div/ul/li[3]")
hover = ActionChains(driver).move_to_element(element_to_hover_over)
hover.perform()
time.sleep(2)
driver.find_element_by_xpath("//li/a[text()='Pre-Open Market']").click()
Access Denied
You don't have permission to access " www.nseindia.com/market-data/pre-open-market-cm-an... " on this server.
Reference #18.6dfd733e.1628459288.e3c22b6
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question