Warn Watir [Depreciation] using the :class locator to locate multiple classes with a string value is deprecated. Use array instead
i get this error while running this line
browser.button(:class => '_t38eb _ov9ai').click
which i think is one class not multiple classes i tried this as mention in the warring
browser.button(:class => ['_t38eb','_ov9ai']).click
but the page freezes then terminate the web i'm trying to scarab is Instagram here trying to log in the page after filling the username and password field
and if i write this the chromedriver terminates
browser.button(:class == '_t38eb _ov9ai').click
There is a difference between Chrome driver and Firefox Driver while you automate, Your browser is closing because chrome driver closes the browser once after the execution of your code but Firefox driver doesn't closes the browser. If you want to keep your chrome browser open, then use this code
require 'watir'
caps = Selenium::WebDriver::Remote::Capabilities.chrome(chrome_options: {detach: true})
b = Watir::Browser.new :chrome, desired_capabilities: caps
The given below code doesn't work
browser.button(:class == '_t38eb _ov9ai').click
That's because button()
method need Hash Object not the object of TrueClass
or FalseClass
which you are passing while you write :class == '_t38eb _ov9ai'
If you want to pass an array, you may better use #split:
browser.button(:class => '_t38eb _ov9ai'.split).click