0

I have created this Keyword:

Validate Header 
Wait Until Page Contains     id=outputtext-text-Header:ApplicationHeaderCoachView1:ApplicationHeaderCoachViewInner1:Output_Text1
Element Should Be Visible    id=outputtext-text-Header:ApplicationHeaderCoachView1:ApplicationHeaderCoachViewInner1:Output_Text1

But it always fail and give me this error:

Text 'id=outputtext-text-Header:ApplicationHeaderCoachView1:ApplicationHeaderCoachViewInner1:Output_Text1' did not appear in 5 seconds.

The Element HTML Code is:

<p id="outputtext-text-Header:ApplicationHeaderCoachView1:ApplicationHeaderCoachViewInner1:Output_Text1" aria-labelledby="outputtext-label-Header:ApplicationHeaderCoachView1:ApplicationHeaderCoachViewInner1:Output_Text1" class="text-left">FCP</p>

I'm trying to verify that element is present on the page. I don't care about the text that this element display, I only need to verify its filled on the page. But always have this error that element did not appear in 5 seconds. I already try Element Should Be Visible, Page Should Contain Element, Page Should Contain TextField and other keywords.

1

The Wait Until Page Contains keyword waits for a text, that should appear on the page. From documentation:

Waits until text appears on current page.

Fails if timeout expires before the text appears.

You have passed a locator for an element as the expected text and that won't be visible on the page. If you check the error message, it states "Text 'id=..." did not appear.

What you need is the Wait Until Page Contains Element which will wait until an element appears on the page.

Waits until element locator appears on current page.

Fails if timeout expires before the element appears.

  • @Carlos Peixoto Did you manage to get it work? – Bence Kaulics Feb 9 at 16:16
0

Base on Id of element locator, I assume that it is id of auto generation so you should

1/ Check if it was fixed (or NOT) after every reloading by asking developer or turn on inspector of browser then try reload page and observe that id.

2/ If Id was fixed, I suppose that you should increase time of waiting for element locator because Id is too long and testing framework need time to detect.

If all is unhelpful, you can try to change method to get locator to Xpath or some other.

Example: //p[text()='FCP']

I don't know your structure of HTML so this Xpath is only reference.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.