How to solve the problem of not founding a web page element?

How to solve the problem of not founding a web page element? How is the dynamic object could be used?

Please provide more information about the problem. Read this for guidance:

1 Like

Thank you for your help,
I am testing a web application (developed using JSF Technology), and the problem occurred on the login page. the test run while inserting username and password but after clicking the sign in button this error has appeared;
I used delay actions, wait for page load, wait for element present, but this didn’t work with this case.
this is the error message from the Consol:

Test Cases/Valid Login FAILED because (of) Unable to verify object ‘Object Repository/Page_My Dashboard/span_ui-button’ is visible (Root cause: Web element with id: ‘Object Repository/Page_My Dashboard/span_ui-button’ located by ‘By.xpath: id(“j_idt95:patient_list_btn”)/span[@class=“ui-button-text ui-c”]’ not found)

Test Cases/Valid Login.run:38

this the HTML tag for the button sign In and the other element that should be found in the next page (which is the main page) so I verify that this element is present to ensure that application move to the next page after login but in the chrome window the application stays on the login page.

username text feild HTML code

sign In Button HTML code
Sign In

the element on the next page of login is
DASHBOARD

For more details :
Sorry for missing that, the previous error message that I put in the previous comment is for verifying another element in the same page which is:
This is the error message for the dashboard element that I put the HTML code for it,

Test Cases/Valid Login FAILED because (of) Unable to verify object ‘Object Repository/Page_EMERGENCY-Form Template Setup/span_DASHBOARD’ is visible (Root cause: Web element with id: ‘Object Repository/Page_EMERGENCY-Form Template Setup/span_DASHBOARD’ located by ‘By.xpath: id(“menuform:j_idt45”)/a[1]/span[1]’ not found)

Test Cases/Valid Login.run:38

Hello all,
this is the screenshot for the test script


and also the selection methods of my objects, I select the XPath method here,

script.PNG

SignInbutton.PNG

dashboardObject.PNG

This is very confusing to follow.

I’m assuming there is ONE line that is failing, which is the line before closeBrowser, that says verifyElementVisible. That line has the error:

Test Cases/Valid Login FAILED because (of) Unable to verify object
‘Object Repository/Page_EMERGENCY-Form Template Setup/span_DASHBOARD’ is
visible…

You’ve shown that element has the following xpath:

But the error message goes on to say a DIFFERENT xpath:

(Root cause: Web element with id: ‘Object Repository/Page_EMERGENCY-Form
Template Setup/span_DASHBOARD’ located by ‘By.xpath:
id(“menuform:j_idt45”)/a[1]/span[1]’ not found)

I’m sorry, but this is meant to be engineering, but with a jumble of misquoted errors and ill-formatted posts, it’s impossible to fathom what’s really going on and perform any kind of analysis.

I advise you edit your posts and fix them, or, abandon this thread and post again with a more succinct error report and any relevant supporting information (HTML, xpaths, etc).

image.png

Hello All
Thank you Russ Thomas for your notes and help. I’m sorry that my posts are not clear but I will fix them here step by step.
First: the final screenshot is the wrong one, it is for the dashboard link, so this the right one for the dashboard span is that

DashboardSpan.PNG

this is the screenshot for the test script
this is for sign in button object and the selection method of my objects, I select the XPath method here,

The Third point is: the application stays at the login screen which seems that doesn’t move to the next page to see the object that is needed to be verified.

login page of the application

Login screen.PNG

Is there a reason why are you using WebUI.clickOffset() with (0,0) coordinates?

I would first get sure your ‘Sign in’ button gets clicked. Try using the regular WebUI.click() on the button and then something like WebUI.waitForElementNotVisible() to make sure you are no longer on the login screen.

1 Like

After executing the test script the chrome stops at the login screen as I said before.
I need to add a note that I have used clickOffset action for the login button instead of click because click didn’t work with me.
The HTML code for the login Button is:

<button id="login:j_idt15" name="login:j_idt15" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-left raised-btn rounded-btn" onclick="PrimeFaces.bcn(this,event,[function(event){showLoading()},function(event){PrimeFaces.onPost();}]);" type="submit" role="button" aria-disabled="false"><span class="ui-button-icon-left ui-icon ui-c fa fa-user"></span><span class="ui-button-text ui-c">Sign In</span></button>

The HTML Code for dashboard span is :

<span>DASHBOARD</span>

The error message in the log viewer after the test case failed is

Test Cases/Valid Login FAILED because (of) Unable to verify object ‘Object Repository/Page_EMERGENCY-Form Template Setup/span_DASHBOARD’ is visible (Root cause: Web element with id: ‘Object Repository/Page_EMERGENCY-Form Template Setup/span_DASHBOARD’ located by ‘By.xpath: id(“menuform:j_idt45”)/a[1]/span[1]’ not found)
Test Cases/Valid Login.run:38

maha,

I don’t have the time to backtrack in this thread hoping I don’t
accidentally read “the wrong post” and further confuse the issue.

My advice is as I stated earlier:

I’m sorry, but this is meant to be engineering, but with a
jumble of misquoted errors and ill-formatted posts, it’s impossible to
fathom what’s really going on and perform any kind of analysis.

I advise you edit your posts and fix them, or, abandon this thread and post again with a more succinct error report and any relevant supporting information (HTML, xpaths, etc).

Let me say it more forcefully: If I had the powers to do so, I would close this thread.

This is NOT personal. It’s merely a matter of efficacy. This thread is too costly (time-wise).

Sorry.