I'm trying to locate the twitter login button using a gem called Watir.
This is the button markup:
<button type="submit" class="submit EdgeButton EdgeButton--primary EdgeButtom--medium">Log in</button>
This is my code:
# Click Login Button
browser.button(:class => ['submit' 'EdgeButton' 'EdgeButton--primary' 'EdgeButtom--medium'],:tag_name=>"button").click
I receive this error:
Watir::Exception::UnknownObjectException: timed out after 30 seconds, > waiting for Watir::Button: located: false; > {:class=>["submitEdgeButtonEdgeButton--primaryEdgeButtom--medium"], > :tag_name=>"button"}> to be located; Maybe look in an iframe?> > C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/watir-6.10.3/lib/watir/elements/element.rb:664:in >
rescue in element_call' > C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/watir-6.10.3/lib/watir/elements/element.rb:680:in >
element_call' > C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/watir-6.10.3/lib/watir/elements/element.rb:125:in >click' C:/Users/bnbih/Desktop/ig_bot/auto_follow_tw.rb:34:in
start' > C:/Users/bnbih/Desktop/ig_bot/auto_follow_tw.rb:77:in<top > (required)>' > C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/ocra-1.3.10/bin/ocra:1211:in >
load' > C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/ocra-1.3.10/bin/ocra:1211:in ><top (required)>' C:/Ruby24-x64/bin/ocra:23:in
load' > C:/Ruby24-x64/bin/ocra:23:in `'
You can locate using text, write the following code,
browser.button(text: 'Log in').click
If you still want to use class locator then
b.button(class: 'submit EdgeButton EdgeButton--primary EdgeButtom--medium').click