Not find element which Exist in Web.

Ask general questions here.
HuongTT
Posts: 11
Joined: Thu Sep 15, 2016 3:55 am

Not find element which Exist in Web.

Post by HuongTT » Wed Dec 07, 2016 11:54 am

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.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Not find element which Exist in Web.

Post by odklizec » Wed Dec 07, 2016 12:34 pm

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.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

HuongTT
Posts: 11
Joined: Thu Sep 15, 2016 3:55 am

Re: Not find element which Exist in Web.

Post by HuongTT » Thu Dec 08, 2016 4:08 am

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);
You do not have the required permissions to view the files attached to this post.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Not find element which Exist in Web.

Post by odklizec » Thu Dec 08, 2016 8:28 am

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? ;)
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

HuongTT
Posts: 11
Joined: Thu Sep 15, 2016 3:55 am

Re: Not find element which Exist in Web.

Post by HuongTT » Thu Dec 08, 2016 10:15 am

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.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Not find element which Exist in Web.

Post by odklizec » Thu Dec 08, 2016 10:41 am

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.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration