Skip to content

add find element(s) under another element - #37

Open
propenster wants to merge 1 commit into
saresend:masterfrom
propenster:findelemfromelem
Open

add find element(s) under another element#37
propenster wants to merge 1 commit into
saresend:masterfrom
propenster:findelemfromelem

Conversation

@propenster

Copy link
Copy Markdown

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