Muhammed Benli
Muhammed Benli

Reputation: 1

How to locate the webelement in the picture

I need to locate the web element in the picture

enter image description here

Any help would be great

Upvotes: 0

Views: 37

Answers (2)

undetected Selenium
undetected Selenium

Reputation: 193088

To locate the desired element you can use either of the following Locator Strategies:

  • Using Java and cssSelector:

    WebElement element = driver.findElement(By.cssSelector("span#filter-msg-ports[title='Multiple Ports']"));
    
  • Using Python and xpath:

    element = driver.find_element(By.XPATH, "//span[@title='Multiple Ports' and text()='Multiple Ports']")
    

Upvotes: 1

Marek
Marek

Reputation: 448

if an element has an id attribute, using By.id locator is the best way to locate such element

WebElement element = driver.findElement(By.id("filter-msg-ports"));

Upvotes: 0

Related Questions