Forum: Ruby browser.html diffrent from the page source - watir-webdriver

Posted by Prog Rammer (proggrammer)
on 2012-11-26 02:48
Hi,

if I go to a page using watir-webdriver+ruby, and right click and view
source on firefox I see following code:

<a href="/mylink.html" class="my_links">Your home<span class="top
arrow"></span></a>

if I do browser.html in ruby it gives:
<a class="my_links" href="/mylink.html">Your home<span class="top
arrow"></span></a>

Why? and suppose I have input files which contains strings like:
<a href="/mylink.html" class="my_links">Your home<span class="top
arrow"></span></a>

I want to match with html source, but due to this problem it fails. Any
solution?
Posted by Joel Pearson (virtuoso)
on 2012-11-27 14:50
If this is consistent it might just be the order in which watir is 
processing the elements. You'd probably be best off making a check which 
allows for the attributes to be in different orders, or sorts them 
before checking for differences.
Posted by Prog Rammer (proggrammer)
on 2012-11-28 15:06
Joel Pearson wrote in post #1086689:
> If this is consistent it might just be the order in which watir is
> processing the elements. You'd probably be best off making a check which
> allows for the attributes to be in different orders, or sorts them
> before checking for differences.

Thats a great solution, but isnt it costly? I guess there may be some 
cheap solutions.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.