Different information between browsers
Different information between browsers
Hi all. I coded one test in C# to be executed in chrome, firefox and internet explorer. In my test for a couple of methods, I use Dynamic attributes to operate with them. In chrome and firefox the information is the same but in internet explorer no and I cannot identify styles as in firefox and chrome. Is there any option to cope with this? Thanks
You do not have the required permissions to view the files attached to this post.
Re: Different information between browsers
Hi,
Could you please post an HTML sample describing your problem? Use for example http://jsfiddle.net/ where you can publish both HTML and CSS code so we can clearly see the issue. Thanks!
BTW, even if the "style" attribute is not displayed in Spy (in IE), it my still be possible to obtain particular style from code, for example like this:
Could you please post an HTML sample describing your problem? Use for example http://jsfiddle.net/ where you can publish both HTML and CSS code so we can clearly see the issue. Thanks!
BTW, even if the "style" attribute is not displayed in Spy (in IE), it my still be possible to obtain particular style from code, for example like this:
Code: Select all
string textDecoration= elementName.getstyle("text-decoration");
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
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Different information between browsers
Hello Juan,
I'm sorry to tell you that the 'style' attribute is currently not supported in IE.
As mentioned by odklizec you could use the WebElement.GetStyle() method to read specific style properties.
Another workaround would be accessing certain style properties in the RanoreXPath directly. For example, you could use 'text-align' to identify the h1 tag in every browser.
RanoreXPath: /dom[@caption='Tryit Editor v3.1']//h1[@text-align='center']
I hope this information will help you.
Sincerely,
Johannes
I'm sorry to tell you that the 'style' attribute is currently not supported in IE.
As mentioned by odklizec you could use the WebElement.GetStyle() method to read specific style properties.
Another workaround would be accessing certain style properties in the RanoreXPath directly. For example, you could use 'text-align' to identify the h1 tag in every browser.
Code: Select all
<h1 style="color:blue;text-align:center">This is a header</h1>
I hope this information will help you.
Sincerely,
Johannes
Re: Different information between browsers
Thanks! I solved it with elementName.getstyle("text-decoration");
Re: Different information between browsers
No I found another problem... These are my styles:
'TextEdit No Wrap'
text-decoration: none (expected underline)
font-style: normal (expected italic)
font-weight: 400 (expected bold)
background-color: #fff (expected red)
'TextEdit With Wrap'
text-decoration: none (expected underline)
font-style: normal (expected italic)
font-weight: 400 (expected bold)
background-color: #fff (expected red)
Those expected values It's what I obtain in Chrome and Firefox using Dynamic values from style.
Why in internet explorer I obtain different values and why cannot the values are the same for both styles in internet explorer?
And using GetStyle() this is what I obtain in my Report in internet explorer:'TextEdit No Wrap'
text-decoration: none (expected underline)
font-style: normal (expected italic)
font-weight: 400 (expected bold)
background-color: #fff (expected red)
'TextEdit With Wrap'
text-decoration: none (expected underline)
font-style: normal (expected italic)
font-weight: 400 (expected bold)
background-color: #fff (expected red)
Those expected values It's what I obtain in Chrome and Firefox using Dynamic values from style.
Why in internet explorer I obtain different values and why cannot the values are the same for both styles in internet explorer?
You do not have the required permissions to view the files attached to this post.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Different information between browsers
Hi Juan,
Unfortunately, the result of the WebElement.GetStyle() method depends on the browser. Nevertheless, the returned result is valid in any case.
For example, the font-weight "400" is equivalent to "normal". In this case, you will need to handle both browsers separately. I would suggest implementing a user code action that checks which browser is currently tested and processes the result accordingly.
Thank you for your understanding.
Sincerely,
Johannes
Unfortunately, the result of the WebElement.GetStyle() method depends on the browser. Nevertheless, the returned result is valid in any case.
For example, the font-weight "400" is equivalent to "normal". In this case, you will need to handle both browsers separately. I would suggest implementing a user code action that checks which browser is currently tested and processes the result accordingly.
Thank you for your understanding.
Sincerely,
Johannes
Re: Different information between browsers
Yes, but the main problem is that with IE it doesn't matter what's the text style. It's always returning the same values for every different styles so I can only handle different styles with Chrome and Firefox but not with IE
Re: Different information between browsers
Hi Juan,
As mentioned by Johannes, IE displays HTML style values differently, but of course, they should not be the same for each style you use So could you please post an HTML/CSS sample we can examine?
As mentioned by Johannes, IE displays HTML style values differently, but of course, they should not be the same for each style you use So could you please post an HTML/CSS sample we can examine?
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: Different information between browsers
The CSS styles are different but they return always same 'Without any Style' values
You do not have the required permissions to view the files attached to this post.
Re: Different information between browsers
Please post the code as a text, not as a picture. Thanks!
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: Different information between browsers
Text without style
HTML
<label class="nvc-edit-label" style="font-style: normal; font-weight: normal; text-decoration: none;">TextEdit No Wrap</label>
CSS
{
text-decoration: none;
font-style: normal;
font-weight: normal;
}
Text with style
HTML
<label class="nvc-edit-label" style="font-style: italic; font-weight: bold; text-decoration: underline; background-color: red;">TextEdit With Wrap</label>
CSS
{
text-decoration: underline;
font-style: italic;
font-weight: bold;
background-color: Red;
}
HTML
<label class="nvc-edit-label" style="font-style: normal; font-weight: normal; text-decoration: none;">TextEdit No Wrap</label>
CSS
{
text-decoration: none;
font-style: normal;
font-weight: normal;
}
Text with style
HTML
<label class="nvc-edit-label" style="font-style: italic; font-weight: bold; text-decoration: underline; background-color: red;">TextEdit With Wrap</label>
CSS
{
text-decoration: underline;
font-style: italic;
font-weight: bold;
background-color: Red;
}
Re: Different information between browsers
So, I just tried it (with Ranorex 6.1 Spy and IE11) and it seem the GetStyle works for me as expected?
I got this from GetStyle (called from Spy):
TextEdit With Wrap:
I got this from GetStyle (called from Spy):
TextEdit With Wrap:
TextEdit No Wrap:text-decoration = underline
font-style = italic
font-weight = 700 (means bold in IE)
background-color = red
text-decoration = none
font-style = normal
font-weight = 400 (means normal in IE)
Last edited by odklizec on Wed Oct 19, 2016 11:24 am, 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: Different information between browsers
We are currently using Ranorex 5.4.6. I suppose we have to migrate to 6.1 version. I hope with this new version this problem is no longer happening. Thanks!
Re: Different information between browsers
Apparently, it got fixed? I believe there was a "style" related bug resolved in 6.x? Anyway, it seems the GetStyle works in 6.1?
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: Different information between browsers
I didn't test it. I believe in you , but I will try myself