Hi Everyone,
I got hybrid app running on iOS on iPod (iOS 9.3.2).
Is it possible to use css selectors as XPaph to access objects?
Does someone have example for use of css selectors with hybrid apps?
Thanks,
Felix.
Use of css selector to find object.
Re: Use of css selector to find object.
Hi,
Could you please upload a Ranorex snapshot from your app?
As long as the css selectors are visible in spy (in 'style' attribute), you should be able to use them in xpath as any other attributes. For example, for HTML code with defined style:
Could you please upload a Ranorex snapshot from your app?
As long as the css selectors are visible in spy (in 'style' attribute), you should be able to use them in xpath as any other attributes. For example, for HTML code with defined style:
You can use this xpath with style attribute:<h1 style="color:blue;">This is a Blue Heading</h1>
//body/h1[@innertext='This is a Blue Heading' and @style='color:blue']
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: Use of css selector to find object.
Hi odklizec,
Yes, please see attachment with snapshot.
My problem with divs that is on this picture: I need to validate innertext attribute for object div[@class='mdl-card__supporting-text pi-accent-one-color']
Thanks,
Felix.
Yes, please see attachment with snapshot.
My problem with divs that is on this picture: I need to validate innertext attribute for object div[@class='mdl-card__supporting-text pi-accent-one-color']
Thanks,
Felix.
You do not have the required permissions to view the files attached to this post.
Re: Use of css selector to find object.
Hi,
There seems to be no InnerText in the div you mentioned and no style attributes? At least not in the element returned by the xpath I tried:
http://www.ranorex.com/support/user-gui ... html#c8203
You will of course have to modify it to work with DIVs instead of HTML table.
There seems to be no InnerText in the div you mentioned and no style attributes? At least not in the element returned by the xpath I tried:
However, there seems to be a number of divs under the returned element. And some of them contain innertext attributes. So if the text in these divs are the texts you need to validate, then I'm afraid, you will have to write some custom code to validate them? I mean, using custom code would be most probably the most efficient way to validate these divs. I would suggest to save the parent div (with all its children) as a reference snapshot and then compare it, from code, with the actual one. Check for example this code sample:/mobileapp[@title='au.com.planetinnovation.gidget']//div[@class='mdl-card__supporting-text pi-accent-one-color']
http://www.ranorex.com/support/user-gui ... html#c8203
You will of course have to modify it to work with DIVs instead of HTML table.
You do not have the required permissions to view the files attached to this post.
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: Use of css selector to find object.
Hi odklizes,
I have problem with divs which are under div selected on picture I attached. If you look down the tree you will find two more divs with the same class attribute.
Anyway, thank you for replay. If you will find some more suggestions I will be happy to see it.
Thanks,
Felix.
I have problem with divs which are under div selected on picture I attached. If you look down the tree you will find two more divs with the same class attribute.
Anyway, thank you for replay. If you will find some more suggestions I will be happy to see it.
Thanks,
Felix.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Use of css selector to find object.
Hi Felix,
Unfortunately, I'm not exactly sure if this problem is already resolved. It would be great if you could get in touch with me by email ([email protected]) to discuss the problem in more detail.
Thank you.
Regards,
Markus (S)
Unfortunately, I'm not exactly sure if this problem is already resolved. It would be great if you could get in touch with me by email ([email protected]) to discuss the problem in more detail.
Thank you.
Regards,
Markus (S)