Skip to content

add find element(s) under another element #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

propenster
Copy link

This PR is in response to this open issue: #36

It is supposed to allow one query/find element from other element (say like a parent element).

For example, let's say I have this block of html document.

This is a paragraph under this Div

This is another paragraph under my Div

This is span

To get all paragraphs underneath this Div, I could get this myDIv first, and then pass a find_element (for 1 sub element) on it to get an element taking myDiv as my starting node. I could do similar to fetch mulitiple Element from myDiv

let parent_element = driver.find_element(Selector::CSS, "#myDiv").unwrap();
// get all paragraphs under myDiv
let all_paragraphs_under_my_div = parent_element.find_element(Selector::CSS, "p").unwrap();

// get the span under myDiv
let span_element = parent_element.find_element(Selector::CSS, ".my-span").unwrap();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant