0

I need to locate the web element in the picture

enter image description here

Any help would be great

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352

2 Answers2

1

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']")
    
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
0

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"));
Marek
  • 438
  • 5
  • 10