Python Selenium Access Denied You don't have permission to access “website” on this server

Submitted 3 years, 7 months ago
Ticket #127
Views 2064
Language/Framework Python
Priority Medium
Status Closed

I was trying to login in this website https://www.henryschein.com/us-en/Profiles/Login.aspx using Python Selenium and Chrome driver but it says that Access Denied You don't have permission to access "http://www.henryschein.com/us-en/Profiles/Login.aspx" on this server. Even when I try to go other pages of this website it gives the same result. The same result for Firefox.

Submitted on Sep 10, 20
add a comment

1 Answer

Verified

from selenium import webdriver 
import requests
from bs4 import BeautifulSoup

url = 'https://www.henryschein.com/us-en/Profiles/Login.aspx'

def find_page_items(driver,link):
    driver.get(link)
    item_link = [item.find_element_by_tag_name('a').get_attribute('href') for item in driver.find_elements_by_css_selector('li.productThumbnailItem')]
    for newlink in item_link:
        res = requests.get(newlink,headers={"User-Agent":"Mozilla/5.0"})
        soup = BeautifulSoup(res.text,"lxml")
        name = soup.select_one("h1[itemprop='name']").text.strip()
        print(name)

if __name__ == '__main__':
    driver = webdriver.Chrome()
    try:
        find_page_items(driver,url)
    finally:
        driver.quit()

Submitted 3 years, 6 months ago


Latest Blogs