Dear All,
I am doing some tests in HTML involving a label element, of which I need to check the width.
From the spy, I see
But I simply do not know how to check in the test that the value is 300.
I have a repo item but I do not know how to put it into a form that will let me call GetValue or equivalent.
Can anyone help? Thanks!!!
Width of label
- giuseppe.lacagnina
- Posts: 113
- Joined: Fri Sep 18, 2015 10:25 am
- Location: Brunn am Gebirge, Vienna, Austria
Width of label
You do not have the required permissions to view the files attached to this post.
- giuseppe.lacagnina
- Posts: 113
- Joined: Fri Sep 18, 2015 10:25 am
- Location: Brunn am Gebirge, Vienna, Austria
Re: Width of label
I actually managed to produce this code
int test = repo.Client.WizardSteps.FieldLabels.LblEditText.Element.Size.Width;
but when I debug... I get 0. The Spy sees "300".
int test = repo.Client.WizardSteps.FieldLabels.LblEditText.Element.Size.Width;
but when I debug... I get 0. The Spy sees "300".
Re: Width of label
Hi guiseppe,
Have you already tried a Validation Action?
It validates if the width is 300 and reports success or failure.
Simply drag and drop the element from the repository to your actions and select validation.
Afterwards you can select the Match Name "Width" and the Match Value "300". (See attached Screenshot)
I hope, this will help!
Have you already tried a Validation Action?
It validates if the width is 300 and reports success or failure.
Simply drag and drop the element from the repository to your actions and select validation.
Afterwards you can select the Match Name "Width" and the Match Value "300". (See attached Screenshot)
I hope, this will help!
You do not have the required permissions to view the files attached to this post.
- giuseppe.lacagnina
- Posts: 113
- Joined: Fri Sep 18, 2015 10:25 am
- Location: Brunn am Gebirge, Vienna, Austria
Re: Width of label
Thanks, but unfortunately the test fails. It finds "100%" and not the actual value that I see in the Spy.
Is this the size of the parent? I tried the same on the parent div, and I get "auto".
Admittedly, the value is greyed out in the Spy. Does this mean it is not directly accessible? Strange.
Is this the size of the parent? I tried the same on the parent div, and I get "auto".
Admittedly, the value is greyed out in the Spy. Does this mean it is not directly accessible? Strange.
Re: Width of label
Hi,
It is hard to help you without further information.
Would it be possible for you to upload a Ranorex Snapshot?
This will make it easier to assist you with your issue.
It is hard to help you without further information.
Would it be possible for you to upload a Ranorex Snapshot?
This will make it easier to assist you with your issue.
- giuseppe.lacagnina
- Posts: 113
- Joined: Fri Sep 18, 2015 10:25 am
- Location: Brunn am Gebirge, Vienna, Austria
Re: Width of label
Unfortunately, I cannot. The issue now boils down to the fact that, when I try to access the width, I get 100%. But the Spy sees the real width, which is 300 pixels. If the real number cannot be retrieved, I will find some workaround.
Re: Width of label
Hi,
Could you please post at least an HTML sample code with problematic label? Just the label itself, not the entire app.
Additionally, you can try ScreenRectangle method...
My guess is that the label is set to be loaded at 100% width of its parent element? Hence you get 100% instead of real size.
Could you please post at least an HTML sample code with problematic label? Just the label itself, not the entire app.
Additionally, you can try ScreenRectangle method...
Code: Select all
int width= repo.Client.WizardSteps.FieldLabels.LblEditText.Element.ScreenRectangle.Width;
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
- giuseppe.lacagnina
- Posts: 113
- Joined: Fri Sep 18, 2015 10:25 am
- Location: Brunn am Gebirge, Vienna, Austria
Re: Width of label
Thanks! The rectangle size gives the same result. I will dig up the code and upload it as soon as I can.
Re: Width of label
Yeah, I've expected that. My guess is that you will have to get the size of its parent element? But the strange thing is, why Spy returns correct size?
BTW, I just tried a simple HTML, where the style section sets the width of label to 100% and Ranorex correctly returns (both in IE and FF) its size in pixels, not just 100%. So I guess the problem must be somehow related to the HTML/stylesheets of your app or the browser you are using?
BTW, I just tried a simple HTML, where the style section sets the width of label to 100% and Ranorex correctly returns (both in IE and FF) its size in pixels, not just 100%. So I guess the problem must be somehow related to the HTML/stylesheets of your app or the browser you are using?
Last edited by odklizec on Wed Mar 01, 2017 12:46 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
- giuseppe.lacagnina
- Posts: 113
- Joined: Fri Sep 18, 2015 10:25 am
- Location: Brunn am Gebirge, Vienna, Austria
Re: Width of label
Well, unsurprisingly, looking at the parent is no good either: it says "auto". It is probably a complex game of boxes and style inheritances. What I also do not understand is why the Spy sees the right number but than the test, dynamically, fails to see the number.
Re: Width of label
Unfortunately, without at least Ranorex snapshot, but even better HTML sample, there is not much anyone here can do or suggest to help you with this problem.
If you can't share the snasphot at public place like this, try contact Ranorex support directly ([email protected]). I'm sure it's pretty safe to send them the snapshot/HTML. Or even better, they may do a remote session with you and suggest the best way to overcome your problem.
If you can't share the snasphot at public place like this, try contact Ranorex support directly ([email protected]). I'm sure it's pretty safe to send them the snapshot/HTML. Or even better, they may do a remote session with you and suggest the best way to overcome your problem.
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
- giuseppe.lacagnina
- Posts: 113
- Joined: Fri Sep 18, 2015 10:25 am
- Location: Brunn am Gebirge, Vienna, Austria
Re: Width of label
Thanks!!! I never contacted the support, but I think it is time to do so.
Let us see
Let us see