Unable to Locate element in salesforce using watir - ruby

Problem 1:
Input:
browser.span(:id => 'ProdSelectionPage_Fav:mainform:pbmain:pSecId:j_id90:txtQuoteDesc').when_present.exist?
Error:
C:/Ruby200/lib/ruby/gems/2.0.0/gems/watir-classic-4.2.0/lib/watir-classic/wait.rb:29:in `until': timed out after 60 seconds (Watir::Wait::TimeoutError)
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/watir-classic-4.2.0/lib/watir-classic/element_extensions.rb:18:in `method_missing'
from C:/WebAutomation/Tests/sandbox/attach.rb:52:in `<main>'
Problem 2:
Input:
browser.frame.text_field(:id, /ProdSelectionPage_Fav:mainform:pbmain:pSecId:j_id90:txtQuoteDesc/).when_present.set'gautam raj'
Error:
C:/Ruby200/lib/ruby/gems/2.0.0/gems/watir-classic-4.2.0/lib/watir-classic/wait.rb:29:in `until': timed out after 60 seconds (Watir::Wait::TimeoutError)
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/watir-classic-4.2.0/lib/watir-classic/element_extensions.rb:18:in `method_missing'
from C:/WebAutomation/Tests/sandbox/attach.rb:56:in `<main>'
Without 'when_present' and used 'sleep 30' before
Input:
browser.frame.text_field(:id, /ProdSelectionPage_Fav:mainform:pbmain:pSecId:j_id90:txtQuoteDesc/).set'gautam raj'
// tried 'name' instead of 'id' for input
Error:
C:/Ruby200/lib/ruby/gems/2.0.0/gems/watir-classic-4.2.0/lib/watir-classic/element.rb:338:in `assert_exists': Unable to locate element, using {:tag_name=>["frame", "iframe"]} (Watir::Exception::UnknownFrameException)
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/watir-classic-4.2.0/lib/watir-classic/frame.rb:21:in `document'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/watir-classic-4.2.0/lib/watir-classic/frame.rb:52:in `__ole_inner_elements'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/watir-classic-4.2.0/lib/watir-classic/locator.rb:204:in `each_element'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/watir-classic-4.2.0/lib/watir-classic/locator.rb:229:in `each'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/watir-classic-4.2.0/lib/watir-classic/locator.rb:217:in `locate'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/watir-classic-4.2.0/lib/watir-classic/input_elements.rb:20:in `locate'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/watir-classic-4.2.0/lib/watir-classic/element.rb:335:in `assert_exists'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/watir-classic-4.2.0/lib/watir-classic/element.rb:484:in `perform_action'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/watir-classic-4.2.0/lib/watir-classic/input_elements.rb:252:in `set'
from C:/WebAutomation/Tests/sandbox/attach.rb:56:in `<main>'
html code:
<input name="ProdSelectionPage_Fav:mainform:pbmain:pSecId:j_id90:txtQuoteDesc" id="ProdSelectionPage_Fav:mainform:pbmain:pSecId:j_id90:txtQuoteDesc" type="text" size="20" maxlength="35">

The problem here is the element you are trying to location never visible to watir.
So with when_present, it will fail with Watir::Wait::TimeoutError error. If you want to click/set the element not visible, it will fail with Watir::Exception::UnknownFrameException error.

The problem here was, when I move to next page, system is throwing error. So, I used below command when I want to move to next page
browser = Watir::Browser.attach(:url, //)
Now, it is working fine

Related

How to locate twitter login button using Watir and Ruby?

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:instart' > 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:inload' > C:/Ruby24-x64/bin/ocra:23:in `'
You have the classes in an array, but do not have commas separating the Strings. The code perceives it to be an array with one long string unless you have the commas.
b.button(class: ['submit', 'EdgeButton', 'EdgeButton--primary', 'EdgeButtom--medium']).click
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

Selenium Webdriver (Ruby) : Cannot click on button - element not found

This is the page code:
<div class="modal-buttons">
<button class="button-orange" ng-click="cancel()">
<span>
Cancel
</span>
<span class="icon cancel"></span>
</button>
<button class="button-orange" ng-click="apply()">
<span>
Apply
</span>
<span class="icon run"></span>
</button>
As you can see - this modal has two buttons and I have tried a dozen different ways - but I just want to click on the button labeled "apply" No matter which route I take - it just keeps saying element not visible.
Here are some of the things I've tried:
# #driver.find_element(:class, "button-orange")[2].click
# #driver.find_element(:xpath, "//div[4]/div/div[2]/div[3]/button[2]").click
# #driver. find_element(:link_text, 'Apply').click
# #driver. find_element(:tag, 'Apply').click
# #driver.find_element(:css, "input[value='Apply']").click();
# #driver.find_element(:css, "input[value='Apply']").click();
# #driver.find_element(:xpath, "//button[contains(text(),'Apply')]").click
# #driver.find_element(:xpath, "//button[contains(text(),'apply')]").click
# #driver.find_element(:xpath, "//input[#value='Apply']").click();
# #driver.find_element(:class, "button-orange.icon-run").click
# #driver.find_element(:css,'a[class$="button-orange"]').click
# #driver.find_element(:xpath, "").clear
The exact error I get is:
Error: test_login_to_chute(LoginToChute)
Selenium::WebDriver::Error::ElementNotVisibleError: element not visible
(Session info: chrome=36.0.1985.125)
(Driver info: chromedriver=2.10.267521,platform=Windows NT 6.3 x86_64)
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.42.0/lib/selenium/webdr
iver/remote/response.rb:51:in `assert_ok'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.42.0/lib/selenium/webdr
iver/remote/response.rb:15:in `initialize'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.42.0/lib/selenium/webdr
iver/remote/http/common.rb:59:in `new'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.42.0/lib/selenium/webdr
iver/remote/http/common.rb:59:in `create_response'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.42.0/lib/selenium/webdr
iver/remote/http/default.rb:66:in `request'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.42.0/lib/selenium/webdr
iver/remote/http/common.rb:40:in `call'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.42.0/lib/selenium/webdr
iver/remote/bridge.rb:634:in `raw_execute'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.42.0/lib/selenium/webdr
iver/remote/bridge.rb:612:in `execute'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.42.0/lib/selenium/webdr
iver/remote/bridge.rb:369:in `clickElement'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.42.0/lib/selenium/webdr
iver/common/element.rb:54:in `click'
C:/Analytics/AutomatedTesting/DevEnv/Wonderland/Full Regression/2.login_to_chute
.rb:165:in `test_login_to_chute'
162: #driver.find_element(:xpath, "(//input[#type='text'])[8]").clear
163: #driver.find_element(:xpath, "(//input[#type='text'])[8]").send_
keys "25"
164:
=> 165: #driver.find_element(:xpath, "//div[4]/div/div[2]/div[3]/button[2]").c
lick
Thank you all so much for helping.
Here's what ended up being the deal.
Because the website is all one angular page, it's loading a bunch of things in the background. Including multiple other buttons that aren't actually visible.
So here's what I ended up using:
#driver.find_elements(:xpath, "//button")[-1].click
And I updated my find_element variable to only find visible elements.
def find_visible_element(how, what)
elems = #driver.find_elements(how, what).select { |e| e.displayed? }
len = elems.length
if len == 0
raise "No matches found."
elsif len > 1
raise "Ambiguous match. Found #{len} matches."
end
elems.first
end
There are several reasons behind this error. I was getting the same error and here is how I narrowed down the possible causes.
The Item can be located in the iframe, in this case you have to switch to the iFrame and locate the element
Another reason can be the element is not yet displayed and you are performing operations on it. In this case you can apply explicit wait as below.
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
wait.until{browser_driver.find_element(:xpath,'***').displayed?}
Using this chunk in your code can help you to wait for maximum 10 seconds till the item is displayed
It is possible that, your xpath is returning more than 1 web element to the driver i.e. more than 1 element can be located with the same xpaths. In this case make sure that your xpath is more specific and returning only one web element. My issue was solved with 3rd possibility.
Wait unti the javascript modal is fully loaded (using a Wait block, for example)
Also, you have to use the correct selector. Frankly, quite of few of your example selectors don't make any sense in the context of the html you posted.
In Chrome's inspector, make sure what it is that a mouseclick would click on. Have you tried selecting the <span>?
Try some of these:
:css => "button.button-orange[ng-click='apply()']"
:xpath => "//button[#ng-click='apply()']"
:xpath => "//button/span[contains(text(),'Apply')]/.."
:css => "button.button-orange[ng-click='apply()'] > span"
:xpath => "//button[#ng-click='apply()']/span"
:xpath => "//button/span[contains(text(),'Apply')]"
By the way, chrome's element inspector has a find function that can search xpath as well as css too for selector testing.

peatio: what is default password for database.yml?

I just tried to install peatio and I see that password is empty in peatio/config/database.yml
what should be written there?
here is screenshot: http://s14.postimg.org/4ijmxjwtt/untitled.png
here is my error from terminal when I tried to start server:
bundle exec rails server
/usr/local/lib/ruby/2.1.0/psych.rb:370:in `parse': (): did
not find expected key while parsing a block mapping at line 6 column 3
(Psych::SyntaxError)
edited, here is full error:
from /usr/local/lib/ruby/2.1.0/psych.rb:370:in parse_stream'
from /usr/local/lib/ruby/2.1.0/psych.rb:318:inparse'
from /usr/local/lib/ruby/2.1.0/psych.rb:245:in load'
from /usr/local/lib/ruby/gems/2.1.0/gems/figaro-0.7.0/lib/figaro.rb:21:i
from /usr/local/lib/ruby/gems/2.1.0/gems/figaro-0.7.0/lib/figaro.rb:17:i
from /usr/local/lib/ruby/gems/2.1.0/gems/figaro-0.7.0/lib/figaro/railtie
from /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.0.2/lib/active_
from /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.0.2/lib/active_
from /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.0.2/lib/active_
from /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.0.2/lib/active_
from /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.0.2/lib/active_
from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.2/lib/rails/applic
from /peatio/config/application.rb:16:in'
from /peatio/config/application.rb:15:in <top (required)>'
from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.2/lib/rails/comman
from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.2/lib/rails/comman
from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.2/lib/rails/comman
from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.2/lib/rails/comman
from bin/rails:4:inrequire'
from bin/rails:4:in `'
Peatio default password for user admin#barong.io is Qwerty123 or Chah5YohWm

Ruby Watir: when_present not appropriately waiting until things are present?

I'm having an issue getting when_present to actually wait until the element is present in certain cases. The problem occurs only intermittently, but it always happens when changing pages.
Example: I want to click save on the current page, then enter text into a field on the subsequent page.
If I do:
$browser.button(:value => "Save").click
sleep 3
$browser.text_field(:label => "Name").when_present.set "Leelluu"
tt works fine.
However, if I do:
$browser.button(:value => "Save").click
$browser.text_field(:label => "Name").when_present.set "Leelluu"
it times out/crashes immediately after clicking "Save".
How do I fix this?
(I know, it seems like I have fixed it by using sleep, but my boss has told me that the sleeps are wasting time. He says I need to remove all of them from the code and find another way.)
Updating with a real-world example..... I enter a search text, then click the search button, then want to select the checkbox next to the leading checkbox on the returned list.
$browser.text_field(:id => /.*search*./).set "Snow Leopard"
$browser.button(:id => "save_filter_PricebookEntry").when_present.click
$browser.checkbox(:id => "allBox").when_present.set
I get an "element not clickable" (even though it has a when_present) on it.
unknown error: Element is not clickable at point (251, 482). Other element would receive the click:
...
(Session info: chrome=31.0.1650.57) (Driver info: chromedriver=2.2,platform=Windows NT 6.1 SP1 x86_64)
["D:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.35.1/lib/selenium/webdriver/remote/response.rb:51:in `assert_ok'", "D:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.35.1/lib/selenium/webdriver/remote/response.rb:15:in `initialize'", "D:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.35.1/lib/selenium/webdriver/remote/http/common.rb:59:in `new'", "D:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.35.1/lib/selenium/webdriver/remote/http/common.rb:59:in `create_response'", "D:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.35.1/lib/selenium/webdriver/remote/http/default.rb:66:in `request'", "D:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.35.1/lib/selenium/webdriver/remote/http/common.rb:40:in `call'", "D:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.35.1/lib/selenium/webdriver/remote/bridge.rb:634:in `raw_execute'", "D:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.35.1/lib/selenium/webdriver/remote/bridge.rb:612:in `execute'", "D:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.35.1/lib/selenium/webdriver/remote/bridge.rb:369:in `clickElement'", "D:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.35.1/lib/selenium/webdriver/common/element.rb:54:in `click'", "D:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.4/lib/watir-webdriver/elements/checkbox.rb:26:in `set'", "D:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.4/lib/watir-webdriver/wait.rb:100:in `method_missing'", "D:/Desktop/jardine/utils.rb:143:in `addQLIs'", "D:/Desktop/jardine/noSleepTest.rb:31:in `block in '", "D:/Desktop/jardine/framework.rb:39:in `execute'", "D:/Desktop/jardine/framework.rb:61:in `block in runTestCases'", "D:/Desktop/jardine/framework.rb:60:in `each'", "D:/Desktop/jardine/framework.rb:60:in `runTestCases'", "jardine.rb:66:in `
'"]

I get these errors trying to build a web service client in Ruby

I am trying to build a web service client in Ruby.
When I try to invoke the following soap4r ruby script to generate web service client code:
wsdl2ruby.rb --wsdl *[web_service_url]* --type client
I get the following error:
ignored attr: {http://www.w3.org/2006/05/addressing/wsdl}Action
I, [2011-06-09T17:16:01.012268 #10104] INFO -- app: Creating class definition.
I, [2011-06-09T17:16:01.012268 #10104] INFO -- app: Creates file 'SessionServic
e.rb'.
F, [2011-06-09T17:16:01.014268 #10104] FATAL -- app: Detected an exception. Stop
ping ... undefined method collect' for #<String:0x32260c8> (NoMethodError)
C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/xsd/codegen/gensupport.rb:2
39:intrim_eol'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/xsd/codegen/gensupport.rb:2
27:in format'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/xsd/codegen/commentdef.rb:2
7:indump_comment'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/xsd/codegen/classdef.rb:51:
in dump'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/wsdl/soap/classDefCreator.r
b:118:inblock in dump_complextype'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/wsdl/soap/classDefCreator.r
b:116:in collect'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/wsdl/soap/classDefCreator.r
b:116:indump_complextype'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/wsdl/soap/classDefCreator.r
b:60:in dump'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/wsdl/soap/wsdl2ruby.rb:77:i
nblock in create_classdef'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/wsdl/soap/wsdl2ruby.rb:171:
in block in write_file'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/wsdl/soap/wsdl2ruby.rb:170:
inopen'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/wsdl/soap/wsdl2ruby.rb:170:
in write_file'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/wsdl/soap/wsdl2ruby.rb:76:i
ncreate_classdef'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/wsdl/soap/wsdl2ruby.rb:62:i
n create_file'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/wsdl/soap/wsdl2ruby.rb:42:i
nrun'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/bin/wsdl2ruby.rb:46:in run'
C:/Ruby192/lib/ruby/1.9.1/logger.rb:691:instart'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/bin/wsdl2ruby.rb:137:in <top (
required)>'
C:/Ruby192/bin/wsdl2ruby.rb:19:inload'
C:/Ruby192/bin/wsdl2ruby.rb:19:in `'
I, [2011-06-09T17:16:01.016268 #10104] INFO -- app: End of app. (status: -1)
When, I try to invoke the following code to dynamically generate the web service client:
require 'soap/wsdlDriver'
WSDL_URL = "http://*[web_service_url]*"
factory = SOAP::WSDLDriverFactory.new(WSDL_URL)
driver = factory.create_rpc_driver
I get the following error:
C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient/session.rb:748:in initialize': The requested service
provider could not be loaded or
initialized. - socket(2)
(http://*web_service_url*) (Errno::E10106)
from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient/session.rb:748:innew' from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient/session.rb:748:in create_socket' from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient/session.rb:705:inblock in connect' from
C:/Ruby192/lib/ruby/1.9.1/timeout.rb:57:in
timeout' from
C:/Ruby192/lib/ruby/1.9.1/timeout.rb:87:in
timeout' from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient/session.rb:704:in connect' from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient/session.rb:568:inquery' from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient/session.rb:158:in query' from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient.rb:1057:in
do_get_block' from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient.rb:866:in
block in do_request' from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient.rb:953:in
protect_keep_alive_disconnected'
from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient.rb:865:in
do_request' from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient.rb:938:in
follow_redirect' from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient.rb:577:in
get_content' from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/importer.rb:73:in
fetch' from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/importer.rb:36:in
import' from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/wsdl/importer.rb:18:in
import' from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/soap/wsdlDriver.rb:146:in
import' from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/soap/wsdlDriver.rb:32:in
initialize' from
C:/DevProjects/application-development-environment/UwsSampleRuby/blah.rb:6:in
new' from
C:/DevProjects/application-development-environment/UwsSampleRuby/blah.rb:6:in
'
When I try to invoke the same code above, but with the a different URL (the production URL instead of the test environment URL), I get a different error:
C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient/session.rb:748:in initialize': getaddrinfo: A non-recoverable error occurred during a database lookup. (https://[prod_url]:443) (SocketError)
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient/session.rb:748:innew'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient/session.rb:748:in create_socket'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient/session.rb:705:inblock in connect'
from C:/Ruby192/lib/ruby/1.9.1/timeout.rb:57:in timeout'
from C:/Ruby192/lib/ruby/1.9.1/timeout.rb:87:intimeout'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient/session.rb:704:in connect'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient/session.rb:568:inquery'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient/session.rb:158:in query'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient.rb:1057:indo_get_block'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient.rb:866:in block in do_request'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient.rb:953:inprotect_keep_alive_disconnected'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient.rb:865:in do_request'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient.rb:938:infollow_redirect'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient.rb:577:in get_content'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/importer.rb:73:infetch'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/importer.rb:36:in import'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/wsdl/importer.rb:18:inimport'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/soap/wsdlDriver.rb:146:in import'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/soap/wsdlDriver.rb:32:ininitialize'
from C:/DevProjects/application-development-environment/UwsSampleRuby/blah.rb:6:in new'
from C:/DevProjects/application-development-environment/UwsSampleRuby/blah.rb:6:in'
Why am I getting these errors, and how do I work around them? I know the web services are up and working, since I'm able to build web service clients in C# .Net just fine.
soap4r has a number of known issues with Ruby 1.9. You should consider using one of the newer SOAP toolkits, such as savon or handsoap.

Resources