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