Titus, I stongly believe checking enabled? present? writable? methods are 
unnecessary calls by WATIR because we know what kind of field we are going 
to interact so these calls to every element slows down the process So what 
I did was, I have CALLED the driver out of WATIR and started writing 
selenium code and wherever I want the help of WATIR help like 
b.table.rows.each, I will write watir code and also If I know there are 
certain element starts to appear after the click then I write watir code, 
So I am mixing the selenium code and WATIR code as shown below, 

For an example, look at the code below and see how I have mixed the 
selenium code and WATIR CODE 

require 'watir'

class Cable

  def initialize
    caps = Selenium::WebDriver::Remote::Capabilities.firefox(marionette: false)
    @b=Watir::Browser.new :firefox, desired_capabilities: caps
    @b.goto 'smcnet.in/'
    @driver=@b.driver
  end

  def call
    @driver.find_element(:id, 'username').send_keys 'raja'
    @driver.find_element(:id, 'password').send_keys ''
    @driver.find_element(:xpath, "//*[@value='Log In']").click
    @driver.find_element(link: 'My Plan').click
    @b.element(xpath: "//span[normalize-space(.)='usage details']").click    # 
WATIR CODE
    puts @b.div(:text, 'MB Used').following_sibling.span.text                # 
WATIR CODE
    puts @b.div(:text, 'Days Remaining').following_sibling.span.text         # 
WATIR CODE
    @driver.find_element(link: 'Hi, RAJAGOPALAN M').click
    @driver.find_element(:xpath, '//li[3]/a').click
    # @driver.quit
  end
end


On Thursday, March 23, 2017 at 10:06:26 AM UTC-7, Titus Fortner wrote:
>
> Yes, #present? is a combination of #exists? and #visible?
>
> Also, with Watir 6, you are less likely to need to make this call 
> explicitly in the code. Taking actions on an element will automatically 
> wait for element to be present if necessary.
>

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to