I'm using selenium to scrape some product pages but lately I've been getting only the login page (instead of the product page that I wanted). So I tried loading the page in my browser and turns out that accessing any product URL will open two tabs: one for login and one for the product itself. So I don't need to login, I just need to be able to scrape from one of the two pages that are opened each time I try to access the URL.
I have a dataframe with the URLs and the different fields that I need to be scraped blank, so then I pass the URL as "myurl" to this function:
item_id=myurl[20:-5]
browser.get(myurl)
html = browser.page_source
soup = BeautifulSoup(html, 'lxml')
try:
titulo = soup.find('div', {'class':'sku-name'}).get_text(strip=True)
except:
titulo=""
and then reading each field from the soup I'm using chromedriver in python
Any help is greatly appreciated!