Skip to content
Advertisement

Tag: selenium-webdriver

Selenium – How to find an element by part of the placeholder value?

Is there any way to find an element by a part of the placeholder value? And ideally, case insensitive. <input id=”id-9″ placeholder=”some TEXT”> Search by the following function doesn’t work browser.find_element(by=By.XPATH, value=”//input[@placeholder=’some te’]”) Answer You can always use contains instead of equals, as following: To make it case-insensitive you can use translate function, as following: Case-insensitive contains Xpath is taken

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()

Advertisement