looking for option to locate icon in element

nuzo :

I tried to check if the eye icon is at the TAB title here, is there way to find it?

here is the image of the DOM the locator i have till now is to the element itself but not to the eye icon

.map-tab--active span

OR

//span[@class="business-in-area"]

Thanks

Sers :

You can get image url using getComputedStyle:

WebDriverWait wait = new WebDriverWait(driver, 20);
JavascriptExecutor js = (JavascriptExecutor) driver;

driver.get("https://maps.b144.co.il/");

WebElement icon = wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("span.business-in-area")));
String iconUrl = (String) js.executeScript("return window.getComputedStyle(arguments[0], ':before').getPropertyValue('content');", icon);

Result:

url("https://maps.b144.co.il/images/icons/f80af126.white_eye_icon.png")

TestNG Assert:

Assert.assertEquals(iconUrl, "url(\"https://maps.b144.co.il/images/icons/f80af126.white_eye_icon.png\")");

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=308788&siteId=1