Hi,
I'm having a Single Page App and I'm trying to click a link from menu. Drop down list is generated by javascript which contains div elements. After executing report says "Element '{SpanTag:Documents}' does exist" but when it should be clicked mouse goes in to top left corner. No error message given
Html
<a href data-bind=click:function(data, event)...>
<span data-testkey="typetree">Documents</span>
</a>
Code example 1
Ranorex.SpanTag spani = "//span[@innertext='Documents' and @data-testkey='typetree']";
Validate.Exists(spani); //Does exists
spani.Click();
Code example 2
Validate.Exists("//span[@innertext='Documents' and @data-testkey='typetree']"); //Does exists
Ranorex.Unknown selectType = "//span[@innertext='Documents' and @data-testkey='typetree']";
selectType.Click();
Cannot click Ranorex identified element in html
Re: Cannot click Ranorex identified element in html
Hi,
I'm afraid, there is not enough information in your post to provide a reliable answer. Please answer below questions:
Ranorex version?
Have you tried using recording modules instead of code?
Could you please upload a Ranorex snapshot (not screenshot) of the element in question?
Could you please post a sample (working) HTML code, we can try (for example at http://www.w3schools.com)?
My guess is, that the element in question is either not unique and Ranorex tries to click the wrong one. Eventually, the element is not entirely loaded/ready at a time when Ranorex tries to click the element?
You see, with HTML (any dynamically loaded GUI), it may happen that Ranorex tries to click the element before the element is fully loaded. It may already be visible, but probably not ready yet. In this case, you may need to add some delays, or even better, waitfor actions here or there.
At first, I would suggest to check the xpath with Ranorex Spy. If it returns more than one elements, then you need to fix your xpath.
If it returns (highlights) just one element, then try to add a delay between expanding the dropdown and actual click.
From your code, it seems as if you trying to click the element without expanding the dropdown? Or is there just missing line in your example?
I'm afraid, there is not enough information in your post to provide a reliable answer. Please answer below questions:
Ranorex version?
Have you tried using recording modules instead of code?
Could you please upload a Ranorex snapshot (not screenshot) of the element in question?
Could you please post a sample (working) HTML code, we can try (for example at http://www.w3schools.com)?
My guess is, that the element in question is either not unique and Ranorex tries to click the wrong one. Eventually, the element is not entirely loaded/ready at a time when Ranorex tries to click the element?
You see, with HTML (any dynamically loaded GUI), it may happen that Ranorex tries to click the element before the element is fully loaded. It may already be visible, but probably not ready yet. In this case, you may need to add some delays, or even better, waitfor actions here or there.
At first, I would suggest to check the xpath with Ranorex Spy. If it returns more than one elements, then you need to fix your xpath.
If it returns (highlights) just one element, then try to add a delay between expanding the dropdown and actual click.
From your code, it seems as if you trying to click the element without expanding the dropdown? Or is there just missing line in your example?
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
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
Re: Cannot click Ranorex identified element in html
Thank you for quick response.
Ranorex version is 5.2.4. Spy show's that xpath is unique. I could provide for you an url if you could see the actual page. It only requires login and clicking a plus icon to open menu. If it is ok I can send you credentials?
BR,
Timo
Ranorex version is 5.2.4. Spy show's that xpath is unique. I could provide for you an url if you could see the actual page. It only requires login and clicking a plus icon to open menu. If it is ok I can send you credentials?
BR,
Timo
Re: Cannot click Ranorex identified element in html
Well, if it's OK for you to send the credentials over web?
Maybe send them via PM.
Anyway, 5.2.4 is pretty old and no longer supported version. I would strongly suggest to try latest 5.4.6.

Anyway, 5.2.4 is pretty old and no longer supported version. I would strongly suggest to try latest 5.4.6.
Last edited by odklizec on Mon Apr 11, 2016 1:06 pm, edited 1 time in total.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
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
Re: Cannot click Ranorex identified element in html
I'm sorry but I can't provide credentials in here but could I send those in some little bit more secure way?
Re: Cannot click Ranorex identified element in html
Sure. I would suggest to create a temporary credentials and send them via PM (private message).
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
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
Re: Cannot click Ranorex identified element in html
Problem solved by replacing below line...
with this one:
Where DictionaryList is a repo element, containing menu elements. So it's faster and much more reliable to find unique span element.
Code: Select all
Ranorex.SpanTag spani = "//span[@innertext='Documents' and @data-testkey='typetree']";
Code: Select all
repo.Sovelia.DictionaryList.TryFindSingle<Ranorex.SpanTag>(".//span[@innertext='"+type+"' and @data-testkey='typetree' and @visible='true']",out spani);
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
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