Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

When I try to find elements inside the current element, the search occurs in the whole web page

For example I get some element:

year_block = browser.find_element_by_xpath('some condition')

There are several similar elements of such kind but I make sure that I've got the proper element using:

print(year_block.get_attribute('innerHTML'))

And then I need to find list of elements inside "year_block" I use:

plant_id_block_list = year_block.find_elements_by_xpath("//*[contains(text(), 'Plant number')]/following-sibling::input")

But in result I get the list of all such elements on a page instead of such elements only inside "year_block"

Where is the problem?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
2.2k views
Welcome To Ask or Share your Answers For Others

1 Answer

等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...