python - Selenium: For loop breaks find_element -


this 1 has me stumped. it's related question: selenium: iterating through groups of elements

this works fine:

print driver.find_element_by_xpath('//div[@class="_1zf"]//div[@class="_946"]//div[contains(text(), "lives in")]').text 

this not:

group = driver.find_elements_by_class_name('_1zf') person in group:     print person.find_element_by_xpath('.//div[@class="_946"]//div[contains(text(), "lives in")]').text 

when put in loop, element can't found.

@automaticstatic:

group list of elements person 1 of elements present in list of elements in group

group = driver.find_elements_by_class_name('_1zf') # group list of elements  person in group:     print person.text     # person 1 of elements present in list of elements in group 

hope work you.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -