7stud2
(7stud --)
29 April 2013 08:34
1
Hi,
I wrote a script and it was running fine. But from today it stopped
working.
This is the part of the script:
···
========================================
require 'selenium-webdriver'
require 'win32ole'
driver = Selenium::WebDriver.for :firefox
begin
driver.get "https://example.com/ "
rescue Selenium::WebDriver::Timeout::Error
driver.manage.timeouts.page_load = 10
end
element = driver.find_element :name => "username"
element.send_keys "*****"
element = driver.find_element :name => "password"
element.send_keys "********"
element.submit
It's giving me continuous error:
C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:146:in `rescue in rbuf_fill':
Timeout::Error (Timeout::Error)
I tried to handle it,but still not handled properly. What could be the
reason?
I am using "selenium-webdriver (2.30.0, 2.27.2)" with "Firefox 12.0" and
"ruby 1.9.3p374 (2013-01-15) [i386-mingw32]"
Thanks
--
Posted via http://www.ruby-forum.com/ .
7stud2
(7stud --)
29 April 2013 09:24
2
It means you timed out trying to access the URL.
In your given case, that would be because "https://example.com/ " doesn't
exist.
This is often a firewall issue or the site being unavailable at the time
the page request was made.
If it's started happening after an update, it could also be that you're
mismatching versions of Firefox and Webdriver.
···
--
Posted via http://www.ruby-forum.com/ .
7stud2
(7stud --)
30 April 2013 08:26
3
Inside my loop, I have statements like below:
···
============================
elems =
driver.find_elements(:xpath,"//div[contains(@id ,'20120692.outline')]/input")
puts elems[1].attribute(:value),elems[1]
elems[0].click if elems[1].attribute(:value) == "No"
puts elems[1].attribute(:value),elems[1]
============================
It outputs when I ran the script:
Yes
#<Selenium::WebDriver::Element:0x17a1860>
Yes
#<Selenium::WebDriver::Element:0x17a1860>
"Supplier Edit Location Request"
No
#<Selenium::WebDriver::Element:0x1640eb0>
1 #<~~~ why one here? I expect Yes.Looking at the webpage I can see that
check-box getting checked. But from where `1` comes out?
*************************************
HTML :
<div id="20120692.outline" class="boolean outline checkboxLabel">
<input type="checkbox" name="foo" tabindex="505" value="1"
onclick="setBooleanValue(this);" onchange="" onfocus="" id="20120692">
<input type="hidden" name="foo" value="No" id="20120692_hidden">
Thanks
</div>
--
Posted via http://www.ruby-forum.com/ .
7stud2
(7stud --)
30 April 2013 08:54
4
The one isn't coming from anywhere in the code you posted. It would have
to come from a line underneath your last one.
Your HTML omits the script for the function "setBooleanValue" as well,
this might be related.
···
--
Posted via http://www.ruby-forum.com/ .
7stud2
(7stud --)
30 April 2013 09:51
5
I ran a test using the HTML and code provided. No "1" appeared.
···
--
Posted via http://www.ruby-forum.com/ .
7stud2
(7stud --)
30 April 2013 10:11
6
But I am getting. Don't know the reason
C:\Documents and Settingsby\Scripts>business_hierarchy_updation.rb
Yes
#<Selenium::WebDriver::Element:0x11092f8>
Yes
#<Selenium::WebDriver::Element:0x11092f8>
"Supplier Edit Location Request"
No
#<Selenium::WebDriver::Element:0x15c8ce8>
1
#<Selenium::WebDriver::Element:0x15c8ce8>
"Supplier Edit Location Request"
Time Duration:- 6
C:\Documents and Settingsby\Scripts>
···
--
Posted via http://www.ruby-forum.com/ .
7stud2
(7stud --)
2 May 2013 11:18
7
I wrote the below line :
bol = driver.find_elements(:class, "hierarchyTextBox").all? do |el|
el.attribute(:value) == "";
end
p bol
driver.find_element(:class, "nice small white radius button").click if
bol == false
But getting error as :
`unknown': Compound class names not permitted
(Selenium::WebDriver::Error::UnknownError)
HTML:
<tr class='rowLight'>
<td colspan="100" style="padding-top:3px">
<input type="button" class="nice small white radius button" value="Add
New row" onclick='addBlankRow($("grid_1"), true);return false'>
</td>
</tr>
What could be the reason?
···
--
Posted via http://www.ruby-forum.com/ .
7stud2
(7stud --)
2 May 2013 12:34
8
I expect that "nice small white radius button" isn't recognised as valid
HTML because it has spaces in it.
···
--
Posted via http://www.ruby-forum.com/ .
7stud2
(7stud --)
30 April 2013 09:15
9
Joel Pearson wrote in post #1107340:
The one isn't coming from anywhere in the code you posted. It would have
to come from a line underneath your last one.
Your HTML omits the script for the function "setBooleanValue" as well,
this might be related.
Basically when the check box is `checked`,it prints `Yes` `Yes`, but
when unchecked,first prints `No`, as expected,then `1` - which is
confusing.
···
--
Posted via http://www.ruby-forum.com/\ .