Tanoro Tanoro - 1 year ago 91
Ruby Question

Watir not locating tags in simple HTML

I just started using Ruby and Webdriver to process strings of HTML. I waded through the learning curve, but either I am still doing something wrong or Watir's consistency is meh.

I am trying to get Watir to locate a couple of span tags because I want the text in between them. I can puts the HTML into my console just fine. I can see the tags I want. For some reason, my every attempt to path to them returns nil.enter image description here

Answer Source

I don't think it is returning nil. You are doing a puts. The value of the puts is nil. The result of what you passed to puts is on the line right before nil. Try removing the puts and you should get the object directly.