i'm not sure if it slows things down a lot. think you need to do some level of
checking anyway. one way of implementing this sort of thing would be to try to
write or whatever and only do polling when the op is going to fail. i suspect
it's probably done like that.
you'd be better off using just watir once you get more used to all of the dom
methods it provides. it wraps a much more sophisticated api around the
webdriver stuff.
From: Raja gopalan <[email protected]>
To: Watir General <[email protected]>
Sent: Thursday, March 23, 2017 10:16 AM
Subject: Re: [wtr-general] Exist method is needed while I use visible method,
Can it be avoided?
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/'
@[email protected]
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.
[email protected]
http://groups.google.com/group/watir-general
[email protected]
---
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 [email protected].
For more options, visit https://groups.google.com/d/optout.
--
--
Before posting, please read http://watir.com/support. In short: search before
you ask, be nice.
[email protected]
http://groups.google.com/group/watir-general
[email protected]
---
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 [email protected].
For more options, visit https://groups.google.com/d/optout.