Skip to content
Advertisement

Tag: selenium

How to check if there is a picture on a website or not with Python and Selenium

I want to check with a boolean request, if there is a picture on the website: https://portal.dnb.de/opac/mvb/cover?isbn=9783442472352 or not: https://portal.dnb.de/opac/mvb/cover?isbn=3499239663 I don`t know how that is possible. Thank you for your help!! Answer Looks like you should deal with response status – for selenium, take a read: How to get status code by using selenium.py (python code) Alternative approach, get

Replace span tags with whitespace or parse contents as new column with pandas.read_html

I want to scrape Congressional stock trades from Capitol Trades. I can scrape the data, but the column that contains stock tickers has a span tag that separates company names from company tickers. pandas.read_html() removes this span tag, which concatenates company names and tickers and makes it difficult to recover tickers. For example, company names that end with an “INC”

find_element(By.CLASS_NAME…) InvalidSelectorException

I need to navigate to the object with special class, that changes every page refresh So i decided to use bs to find the element class, that works, but selenium raises an exception about invalid selector. class is existing, i can find it in page source. There are some spaces at the beginning and at the ending of class name

How do I stop my scraper from hitting an error whenever it clicks the next button?

Hello so i’m trying to scrape next page on google shopping website. But i get an error whenever my scraper clicks the next button. It stops working when it loads the next page. Here’s my codeblock next_page = driver.find_element(By.XPATH, ‘//*[@id=”pnnext”]’) next_page.click() HERE’S THE ERROR I GET Traceback (most recent call last): File “c:UsersLPDocumentspythonwedgwoodwedgwood.py”, line 50, in name = card.find_element(By.CLASS_NAME, ‘OSrXXb’).text.strip()

Scraping data through changing Xpaths

I can’t figure out how to scrape data, I am trying to scrape the product name, price and other information from the website, the product names are easy to access as they have similar xpath with only one tag that changes but for the prices the there are multiple changes to the tags.Is there an alternative to how I can

locate an a element and click on it in selenium pyhton

I have this page and I want to click on the a element that sends an email(the one that is highlighted in the screenshot below and I have tried to find this element using By.XPATH email = driver.find_element(By.XPATH, “//a[contains(@class, ’email-old-32′)]”).click() and By.CLASS_NAME email = driver.find_element(By.CLASS_NAME, ’email-old-32′).click() and in both situations i’m getting an error no such element, does anyone know

Advertisement