Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does Selenium WebDriver find WebElement

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Here's a summary of several common ways to find page elements from our team code:

(1) through the ID of WebElement

If a WebElement provides ID

(2) search through WebElement's name:

WebElement element = driver.findElement (By.name ("passwd"))

(3) search through WebElement's xpath:

WebElement element = driver.findElement (By.xpath ("/ / input [@ id='passwd-id']"))

(4) search through the style of WebElement:

CheddarGouda

You can find page elements by:

Listcheeses = driver.findElements (By.className ("cheese"))

(5) search through hyperlink text:

Cheese >

Then you can find it like this:

WebElement cheese = driver.findElement (By.linkText ("cheese"))

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report