This is very strange... It's almost as if on this particular internal page 
to Firefox they are running a stripped down xpath version?

".//*[@id='version-box']" works, but throwing td in instead of * does not
Same goes for one of the buttons above, ".//*[@id='copy-to-clipboard']" 
works, but replacing * with button does not.

If you go to www.google.com, "//input[@id='lst-ib']" works fine there.

This is me just entering $x() to use xpath in the browser console itself... 
So it's not the fault of Watir.

If you want it to still use css, you can always do browser.td(css: 
'#version-box'). Or, better yet, instead of going to about:support to get 
the version, just call `browser.capabilities[:browser_version].



On Thursday, August 30, 2018 at 12:28:34 PM UTC-5, Walt wrote:
>
>
> Titus,
>
> Follow up to original post
>
> When I use browser.goto 'about:support' in Firefox to query the version 
> number
>
> browser.td(:id, 'version-box').wait_until { |el| el.present? }
> firefox_version = browser.td(:id, 'version-box').text
>
> using Watir 6.10.3, "css selector" is used 
>
> 2018-08-30 11:33:06 INFO Selenium -> POST 
> session/31489eb6-fc2b-4a41-94f7-e5365bd5a421/element
> 2018-08-30 11:33:06 INFO Selenium    >>> 
> http://127.0.0.1:4444/session/31489eb6-fc2b-4a41-94f7-e5365bd5a421/element 
> | {"using":"css selector","value":"#version\\-box"}
> 2018-08-30 11:33:06 DEBUG Selenium      > {"Accept"=>"application/json", 
> "Content-Type"=>"application/json; charset=UTF-8", 
> "User-Agent"=>"selenium/3.12.0 (ruby windows)", "Content-Length"=>"49"}
> 2018-08-30 11:33:06 INFO Selenium <- 
> {"value":{"element-6066-11e4-a52e-4f735466cecf":"cfb8cf47-34a5-4689-b9c0-31421c01d3c5"}}
> 2018-08-30 11:33:06 INFO Selenium -> GET 
> session/31489eb6-fc2b-4a41-94f7-e5365bd5a421/element/cfb8cf47-34a5-4689-b9c0-31421c01d3c5/name
> 2018-08-30 11:33:06 INFO Selenium <- {"value":"td"}
> 2018-08-30 11:33:06 INFO Selenium -> GET 
> session/31489eb6-fc2b-4a41-94f7-e5365bd5a421/element/cfb8cf47-34a5-4689-b9c0-31421c01d3c5/displayed
> 2018-08-30 11:33:06 INFO Selenium <- {"value":true}
>
> When I switch to Watir 6.11.0, "xpath" is used instead, and times out 
> after 30 secs.
>
> 2018-08-30 11:44:46 INFO Selenium -> POST 
> session/e593aa0b-ab07-4754-a7c7-dcfaa85d848f/element
> 2018-08-30 11:44:46 INFO Selenium    >>> 
> http://127.0.0.1:4444/session/e593aa0b-ab07-4754-a7c7-dcfaa85d848f/element 
> | {"using":"xpath","value":".//td[@id='version-box']"}
> 2018-08-30 11:44:46 DEBUG Selenium      > {"Accept"=>"application/json", 
> "Content-Type"=>"application/json; charset=UTF-8", 
> "User-Agent"=>"selenium/3.12.0 (ruby windows)", "Content-Length"=>"52"}
> 2018-08-30 11:44:46 INFO Selenium <- {"value":{"error":"no such 
> element","message":"Unable to locate element: 
> .//td[@id='version-box']","stacktrace":"WebDriverError@chrome://marionette/content/error.js:178:5\nNoSuchElementError@chrome://marionette/content/error.js:388:5\nelement.find/</<@chrome://marionette/content/element.js:341:16\n"}}
>
> C:/Ruby243-1-x64/lib/ruby/gems/2.4.0/gems/watir-6.11.0/lib/watir/wait.rb:49:in
>  
> `until': timed out after 30 seconds,
>  waiting for true condition on #<Watir::TableDataCell: located: false; 
> {:id=>"version-box", :tag_name=>"td"}> 
> (Watir::Wait::TimeoutError)
>
> Hopefully this additional information will help in troubleshooting.
>
> Thanks,
>
> Walt
>
> On Tuesday, July 17, 2018 at 2:45:33 PM UTC-5, Walt wrote:
>>
>>
>> I've been querying the Firefox version number by using 'about:support' as 
>> the URL and accessing via 
>> @b.td(:id, 'version-box').text
>>
>> This stopped working with Watir 6.11.0. Reverting to Watir 6.10.3, solves 
>> the issue.
>>
>> *Versions:*
>> ruby 2.4.3p205 (2017-12-14 revision 61247) [x64-mingw32]
>> Watir 6.11.0, WebDriver 3.12.0, Firefox 62.0b9, GeckoDriver 0.21.0
>> Windows 7
>>
>> *Relevant code:*
>> @b.goto 'about:support'
>> @b.tds.each do |td|
>>   puts td.id.inspect.to_s     # displays "version-box" amid the 'td' id's
>> end
>> @b.td(:id, 'version-box').wait_until { |el| el.present? } # fails here 
>> with default of 30 secs.
>> firefox_version = @b.td(:id, 'version-box').text
>>
>> *Output:*
>> driver=#<Selenium::WebDriver::Firefox::Marionette::Driver:0x4a4c2204 
>> browser=:firefox>
>> #<struct Selenium::WebDriver::Dimension width=1296, height=974>
>> "application-box"
>> "version-box"     # I'm here!!
>> "buildid-box"
>> <snip>
>> .
>> .
>> "intl-osprefs-systemlocales"
>> "intl-osprefs-regionalprefs"
>> C:/Ruby243-1-x64/lib/ruby/gems/2.4.0/gems/watir-6.11.0/lib/watir/wait.rb:49:in
>>  
>> `until':
>>  timed out after 30 seconds, waiting for true condition on
>>  #<Watir::TableDataCell: located: false; {:id=>"version-box", 
>> :tag_name=>"td"}>
>>  (Watir::Wait::TimeoutError)
>>
>>
>> Thank you,
>>
>> Walt
>>
>

-- 
-- 
Before posting, please read 
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
 
In short: search before you ask, be nice.

[email protected]
http://groups.google.com/group/watir-general
[email protected]
--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to