How to locate a particular image in watir? How to locate a particular image in watir? selenium selenium

How to locate a particular image in watir?


I try to do it, and don't find. By doing exactly the same thing in another website, it works.

Start of your page :

<?xml version="1.0"?><!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

Start of mine to compare:

<!DOCTYPE HTML><html lang="fr" itemscope="" itemtype="http://schema.org/Blog">

The only difference I see is the XML : the page you are playing with is in XML, you should verify that you don't need to parse XML instead of classic HTML.


As far as I can see, the HTML of the first image looks like this:

<img class="greendot-logo" src="/mobile-telstra-racingnetwork-production/theme/img/bpBannerSportLogo_465.png" alt="" height="80" width="232">

You have this:

> browser.img(:src, /mobile/).exist?=> false

But I get this:

> browser.img(:src, /mobile/).exist?=> true 

So, try this:

> browser.img(:src => "/mobile-telstra-racingnetwork-production/theme/img/bpBannerSportLogo_465.png").exists?=> true