Reputation: 1
I need to locate the web element in the picture
Any help would be great
Upvotes: 0
Views: 37
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
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