1

Error received while using the xpath of the dynamic elementI want to fetch the details of login failure from a website to the katalon console. Now, the problem i am facing while doing this is that, katalon cannot find the element by the id of the element because the id is dynamically changing. Hence i am using xpath to solve that problem. But while fetching a text on the website it cannot capture that element with a level tag.

On Clicking the login button thios error appears and then this error should be fetched by Katalon into its own console This is code used to fetch the details of the login error Which printing the variable data 1, i am not able to receive any kind of data in the Katalon log viewer or in the console.

If anyone one could help me on this, it would be much appreciated.

Souvik_07
  • 11
  • 4

1 Answers1

0

The answer to the above problem is to create customized xpaths for all elements which needs to be captured. For example: Creating an xpath for the Ask Question button above. //a[@class="ws-nowrap s-btn s-btn__primary"]

To learn more about how to create unique customized xpaths for all types of element, please watch this video:(https://www.youtube.com/watch?v=3uktjWgKrtI).

I think xpaths are a very usefull tool to access any kind of elements present in any website.

To use the xpaths in katalon by using Selenium drivers : Package files :

import org.openqa.selenium.By as By
import org.openqa.selenium.Keys as Keys
import org.openqa.selenium.WebDriver as WebDriver
import org.openqa.selenium.WebElement as WebElement

Code :

driver.findElement(By.xpath('a[@class="ws-nowrap s-btn s-btn__primary')).click()
Souvik_07
  • 11
  • 4