Unable find object

i only record then playback, but there is an error, i used Chorpath to get xpath but it is errored.

hello,
i suspect that id is generated every time page is displayed. can you confirm this?

if you are testing the web page : https://www.traveloka.com/vi-vn

and then you click on: ve May Bay

and then you click on : origin (or from)
that object has a dynamic id , so for each time you run that test case …the object could not be found because is not the same every time… so you have to find the way to generate and change the xpath for that object. You could test that by pressing f5 key and inspect that element again. if the id is different…that is because the id is dynamic.

try this one:
//*[@placeholder=‘Origin’] or another way to identify that object.

to learn more about xpaths i recomend the following link :
https://www.guru99.com/xpath-selenium.html

thank you, it is dynamic id, but i don’t know how to find object.

thank you,it is dynamic id, then i try //*[@placeholder=‘Origin’] , but it don’t find object.

would be quite helpful if you would share html of page you are trying to test … at least part that contains element of interest…


should work, if not, you will need to address nearest object with text and forge xpath from there

it don’t work

if you did ctr+c and ctrl+v (i suspect) there are strange quotas in xpath, please use standard ones either ’ or " (and put them manually not by ctrl+c and ctrl+v)

1 Like

I think that is the problem . try to put the word : Origin between traditional singles quotes. It seems that your singles quotes are different and not the traditional ones. Try once more please!. … check when you putthe alphanumeric code of id xpath , the singles quotes are in correct format in that xpath