2

I am very new to coding. We are using selenium tool writing scripts in python.

I have the following code for a single web element:

element = driver.find_element_by_css_selector("locator")
           height = element.get_attribute('height')
           print height

Now I have my xpath expression that is returning 8 items for which I have to print the "height" attribute. How can I do this in python?

1 Answer 1

2

Use find_elements_by_css_selector():

for element in driver.find_elements_by_css_selector("locator"):
   height = element.get_attribute('height')
   print height

or, find_elements_by_xpath() if you have an xpath expression.

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

1 Comment

Hi Alec, Can you please look at and let me know if you can help please....stackoverflow.com/questions/26742148/…

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.