Page 1 of 1

Not find element which Exist in Web.

Posted: Wed Dec 07, 2016 11:54 am
by HuongTT
I work on Ranorex 6.1.1 JP version.

I have a test case.
- Open IE (tab1)
- Input User/Password -> click on Login => It will auto display other IE(tab2) and close tab1
- In IE(tab2), I use waitToExist and found Element A.
- Click on Element A => it make error message: Can not find Element A.

I don't know why, it can wait to element exist but can not click on element.
Could you help me?

Thank you.

Re: Not find element which Exist in Web.

Posted: Wed Dec 07, 2016 12:34 pm
by odklizec
Hi,

Unfortunately, there is no way for us to tell what's wrong without seeing the app (small sample app/HTML code) or at a very least Ranorex snapshot (not screenshot!) of the problematic element, plus the xpath for the element stored in repository. If the element is found by WaitForExists, there should not be a problem to click it, unless it's out of visible area or the element is for example hidden at a time of click? Please post the snapshot + xpath and we can tell more.

Re: Not find element which Exist in Web.

Posted: Thu Dec 08, 2016 4:08 am
by HuongTT
Thank for answer me.

Im sorry, this is the first time I attached img and xpath.
I dont know this is correct way or not.

xpath for Item which I want to click on:

Code: Select all

/dom[@domain='URL']/dom[@domain='URL']/?/?/a[@innertext='・Content list ' and @enabled='True']

After InPut user / password then click on Login, tab will auto end and display main menu.
I want to click on Content list in Main menu.

As I said before, Code run ok for step 1 and make error for step 2:

Code: Select all

//1 MyRepo.MyPathInfo.WaitForExists(10000);            

//2 MyRepo.MyPath.Click("57;9");
Delay.Milliseconds(200);

Re: Not find element which Exist in Web.

Posted: Thu Dec 08, 2016 8:28 am
by odklizec
Hi,

At first, please post a Ranorex snapshot(s)! Screenshots are more or less useless, because these don't allow to examine the xpath validity.

At second, please post exact error message you are getting. It's hard to say what's wrong without even knowing the exact error you are getting ;)

At next, at a start of the xpath, the 'dom' element is used twice...why?

Code: Select all

/dom[@domain='URL']/dom[@domain='URL']...
Now what you can try to do (aside eliminating one DOM element), is to add the below code after 'Login' action:

Code: Select all

repo.DOMelement.Self.WaitForDocumentLoaded(10000);
This should assure the next action is not performed before the page is fully loaded (after Login).

Also, I would suggest to change the xpath to something like this:

Code: Select all

/dom[@domain='URL']/?/?/a[@innertext~'Content list' and @enabled='True']
You see, there is no need to have entire "・Content list " sting in the xpath. Just cut it short, without the special "dot" at start and trailing space.

And finally, remove the mouse coordinates from the click method...

Code: Select all

MyRepo.MyPath.Click();
This will make sure the link is clicked in its center.

Hope any of these suggestion helps? ;)

Re: Not find element which Exist in Web.

Posted: Thu Dec 08, 2016 10:15 am
by HuongTT
Please help me.

I can not upload Snapshot to here because it has information about our company & Project.

I installed Ranorex trial version 6.0.2 on November. I created 20 test case and it run ok.(record & play & user code)
Our company just extend license to end of December on yesterday, I execute run & replay new test case but it did not work.
I just want to click on OK button:

Code: Select all

Failed to find item 'MyPath.CmdOK'.
No element found for path '/form[@controlname='frmFilAdd']/?/?/container[@controlname='Panel1']/button[@controlname='cmdOK']' within 600ms
I just reinstall Ranorex 6.2 but it still can not find element.
20 old test care are still run OK.
Ranorex can find All element belong 20 old test case but can not find new element.

Hope you can help.

Re: Not find element which Exist in Web.

Posted: Thu Dec 08, 2016 10:41 am
by odklizec
So, apparently, it fails at a completely different place that you've described in your previous posts? ;) Have you examined the xpath behind the MyPath.CmdOK repo element? There is most probably something different in your app and so the test now fails to find the element because of different xpath. Unfortunately, without snapshot, there is not much else I can suggest.

Just one additional note, the timeout value 600ms is strange. Typically, Ranorex searched the element much longer (default is 30sec per repo element item). Have you changed the SearchTiemout for given element? Especially in case of web apps, it's not a very good idea to lower the search timeout values.