Skip to content

Feature 1539 #1871

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

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -309,13 +309,25 @@ from selenium.webdriver.common.by import By
driver = webdriver.Chrome()
driver.get("https://www.example.com")

##get elements from parent element using TAG_NAME

# Get element with tag name 'div'
element = driver.find_element(By.TAG_NAME, 'div')

# Get all the elements available with tag name 'p'
# NOTE: in order to utilize XPATH from current element, you must add "." to beginning of path
elements = element.find_elements(By.TAG_NAME, 'p')
for e in elements:
print(e.text)

##get elements from parent element using XPATH

# Get first element of tag 'ul'
element = driver.find_element(By.XPATH, '//ul')

# get children of tag 'ul' with tag 'li'
elements = driver.find_elements(By.XPATH, './/li')

{{< /tab >}}
{{< tab header="CSharp" >}}
using OpenQA.Selenium;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,13 +295,24 @@ from selenium.webdriver.common.by import By
driver = webdriver.Chrome()
driver.get("https://www.example.com")

##get elements from parent element using TAG_NAME

# Get element with tag name 'div'
element = driver.find_element(By.TAG_NAME, 'div')

# Get all the elements available with tag name 'p'
# NOTE: in order to utilize XPATH from current element, you must add "." to beginning of path
elements = element.find_elements(By.TAG_NAME, 'p')
for e in elements:
print(e.text)

##get elements from parent element using XPATH

# Get first element of tag 'ul'
element = driver.find_element(By.XPATH, '//ul')

# get children of tag 'ul' with tag 'li'
elements = driver.find_elements(By.XPATH, './/li')
{{< /tab >}}
{{< tab header="CSharp" >}}
using OpenQA.Selenium;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,13 +304,24 @@ from selenium.webdriver.common.by import By
driver = webdriver.Chrome()
driver.get("https://www.example.com")

##get elements from parent element using TAG_NAME

# Get element with tag name 'div'
element = driver.find_element(By.TAG_NAME, 'div')

# Get all the elements available with tag name 'p'
# NOTE: in order to utilize XPATH from current element, you must add "." to beginning of path
elements = element.find_elements(By.TAG_NAME, 'p')
for e in elements:
print(e.text)

##get elements from parent element using XPATH

# Get first element of tag 'ul'
element = driver.find_element(By.XPATH, '//ul')

# get children of tag 'ul' with tag 'li'
elements = driver.find_elements(By.XPATH, './/li')
{{< /tab >}}
{{< tab header="CSharp" >}}
using OpenQA.Selenium;
Expand Down