Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to read a value of the locator #521

Open
RutujaNagare opened this issue Jun 24, 2021 · 3 comments
Open

Not able to read a value of the locator #521

RutujaNagare opened this issue Jun 24, 2021 · 3 comments

Comments

@RutujaNagare
Copy link

RutujaNagare commented Jun 24, 2021

Hi Team,

I am trying to read a value for particular locator and comparing with expected value but my canopy code is reading blank value for that locator.

     let locator = ".//h2[@ng-if="vm.property.PropertyId"]"
     let expectedValue  = "Property Essentials"
     
    displayed locator
    let actualValue = read Locator
    expectedValue === actualValue

I tried many locators which are highlighted using xpath checker add-in also if I write a code to verify element is displayed or not then it works fine.

Attaching screen shot for error and locator identification.

Could you please help?

Locator_ByXpathChecker
Error_AtResult

@lefthandedgoat
Copy link
Owner

Without seeing the html I can only guess. I bet that inside the h2 there is a div or span or some other element that actually contains the value of Property Essentials

@RutujaNagare
Copy link
Author

Hi,

There is no div or span present under h2. Attaching HTML code.
HTMLCode

Facing similar issue with few other locators on same screen. Basically not able to read value of the locators present inside this form.

@lefthandedgoat
Copy link
Owner

Hmm, next guess would be that you are using === instead of ==, the triple = does not do any retries, its like a normal unit test assertion for equality.

== will try again and again until its true or a time limit is hit and it fails. It could be that at the point you are trying to do the assertion, the page is not finished loading and that H2 is not there.

Switching to ".panel-title" == "Property Essentials" will probably fix it.

I dont find myself using read or === very often personally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants