So while tooling around on some stuff, I was trying different ways to use 
selectors in conjunction with some array values.  I came across something 
that I can't quite figure out.

I recreated it using http://automationpractice.com/index.php to be able to 
ask in general without need for people to be in my environment to emulate.

So some details:
Ruby version:  ruby 2.5.3p105 (2018-10-18 revision 65156) [x64-mingw32]
Watir version:  6.11.0
Chromedriver version:  2.46.628402

I know I am not at the latest for Watir and Ruby, I've had to lock in these 
version.

In anycase, at the url I mentioned above 
http://automationpractice.com/index.php I inspected the shopping cart 
element
I noted that the element had a title of "View my shopping cart" and I 
copied the xpath of "//*[@id='header']/div[3]/div/div/div[3]/div/a" (double 
quotes changed to single

The oddity that I am trying to figure out is this:

@browser.element(title: "View my shopping cart").present?  - evaluates true
@browser.element(:title, "View my shopping cart").present? = evaluates true
 @browser.element("title" => "View my shopping cart").present? - evaluates 
true

however,

@browser.element(xpath: 
"//*[@id='header']/div[3]/div/div/div[3]/div/a").present? - evaluates true
@browser.element(:xpath, 
"//*[@id='header']/div[3]/div/div/div[3]/div/a").present? - evaluates true
@browser.element("xpath" => 
"//*[@id='header']/div[3]/div/div/div[3]/div/a").present? - evaluates 
*false*

I tried this with some other elements to similar results

@browser.button(:name, "submit_search").present? - true
@browser.button(name: "submit_search").present? - true
@browser.button("name" => "submit_search").present? -true

@browser.button(xpath: "//*[@id='searchbox']/button").present? - true
@browser.button(:xpath, "//*[@id='searchbox']/button").present? - true
@browser.button("xpath" => "//*[@id='searchbox']/button").present? - false

Can anyone enlighten me on what I am doing wrong?

Thanks,
Steve

-- 
-- 
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