I need to locate the web element in the picture
Any help would be great
CodePudding user response:
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"));
CodePudding user response:
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']")