0

I'm testing a poorly written webpage where on one page the first heading is a H1 then on the next page it's a H2.

Usually I would write something like find('h1', text: 'bla bla bla') or expect(find('h1')).to have_text 'bla bla bla'

As it keeps changing between H1 and H2, is there a way to say find('h1' || 'h2', text: 'bla bla bla)

I'd like to keep the test looking within the headers as the text sometimes exists within the body of the page too.

Tom
  • 1,055
  • 1
  • 14
  • 29
  • 1
    Possible duplicate of [CSS "and" and "or"](http://stackoverflow.com/questions/2797091/css-and-and-or) – Dave Schweisguth May 24 '16 at 14:19
  • As Dave mentioned, this is a duplicate you just didn't know it. It's really a CSS selector question, not a cucumber or ruby question. – Jeff Price May 24 '16 at 18:02
  • As a tester, I'd give to the developer as "which is one wrong, h1 OR h2?", then turn in a defect. – Dave McNulla May 24 '16 at 19:41
  • It has been raised but with other work going on, it's been pretty much pushed to bottom of the backlog. I was just wondering if you could use 'or' within the find command when scoping to a css selector. It doesn't look like you can. – Tom May 25 '16 at 06:56

0 Answers0