I am trying to select and click a link on a web webpage using Selenium. The url is this test site. When I used regular element locator or xpath or cssSelectors:
//div[@class="welcmewrap"]/div/div[3]/div/div[2]/div/div[2]/span[2][contains(text(), "Know More...")]
The chropath showed the message:
It might be child of svg/pseudo element/comment/iframe from different src. Currently ChroPath doesn't support for them.
Similarly, running the methods on selenium as below:
WebDriverManager.firefoxdriver().setup();
WebDriver driver = new FirefoxDriver();
driver.get("https://netbanking.hdfcbank.com/netbanking/");
//method 1
driver.findElement(By.xpath("//span[@class='lightbluecolor'][contains(text(), 'Know More...')]"));
//method 2
driver.findElement(By.xpath("//div[@class=\"welcmewrap\"]/div/div[3]/div/div[2]/div/div[2]/span[@class= ‘lightbluecolor’] [contains(text(), \"Know More...\")]")).click();
System.out.println("know more click");
...returned:
Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to locate element: //span[@class='lightbluecolor'][contains(text(), 'Know More...')]
When I investigated further, it appears to be a nested frame issue but I couldn't find an "iframe" tag on the webpage source.
How to reach that element?