Skip to main content

Posts

Showing posts from February, 2023

Complex scenarios automation in Selenium- Part 1

So for this exercise we will be clicking an any state in this SVG map. https://petdiseasealerts.org/forecast-map#/ So for this exercise, the best chance you getting a valid result is getting the correct xpath. So most of you will get this xpath. String stateXpath = "(//*[name()='svg'])/*[@id='features']/*[@id='regions']/*[@id='" +state+ "']" ; or this String stateXpath= "//*[name()='svg']//*[name()='g' and @id = ' " +state+ " ']" ; with one of this implementations if you ran following code, you will fail at state Florida, with element click intercept exception. package org.example ; import io.github.bonigarcia.wdm.WebDriverManager ; import org.openqa.selenium.By ; import org.openqa.selenium.JavascriptExecutor ; import org.openqa.selenium.WebDriver ; import org.openqa.selenium.chrome.ChromeDriver ; import org.openqa.selenium.chrome.ChromeOptions ; import org.openqa.selenium.support.ui.Expecte...