0

In a webpage I am scraping, there is the CSS code:

<span class="err css-bjzkj7">OUT OF STOCK</span>

I want to get the text "OUT OF STOCK" and check to see if it's changed.

What I tried:

from splinter import Browser
driver = Browser('chrome', **executable_path)
driver.visit(url)
driver.find_element_by_css_selector("err css-bjzkj7").text    

What I get:

AttributeError: 'WebDriver' object has no attribute 'find_element_by_css_selector'

I read about "xpath" but that throws the same error. Selenium version: 3.141.0

2 Answers 2

1

It should be find_by_css() when you use splinter

driver.find_by_css(".err.css-bjzkj7").text  

Or

 driver.find_by_css(".err").text   

Splinter official doc says. you can refer this. Find Element

Sign up to request clarification or add additional context in comments.

Comments

0

I don't know how did you try xpath but my suggestion would be:

driver.find_element_by_xpath("//*[contains(@class, 'err css-bjzkj7')]").text

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.