0

On Windows Server 2012 I am using selenium 2.53.6, and I want to check if the class contains the element lock-icon for the following html element:

<a href="http://my.page/link/somewhere" class="more-link lock-icon" target="_blank">
                       Selenium Projekt dianep geheim
                   </a>

I tried the following expression with the python API:

find_element(by=By.CSS_SELECTOR, value="more-link.lock-icon")

but it returns a None although the element (shown above) is visible on the website.

How to do it correctly?

3 Answers 3

1

try:

find_element(by=By.CSS_SELECTOR, value="a.more-link")
Sign up to request clarification or add additional context in comments.

Comments

1

You should try as below :-

driver.find_element(by=By.CSS_SELECTOR, value="a.lock-icon")

or

driver.find_element_by_css_selector("a.lock-icon")

Hope it will work..:)

Comments

0

Since more-link is also class name you should call it like .more-link.lock-icon. See the following:

find_element(by=By.CSS_SELECTOR, value=".more-link.lock-icon")

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.