E
Espen Falkevik
I use the Watir extension to generate automated test
for web pages. To control the test results I retrieve
information from the same web page, but I get the
information from a XML-file.
I use the REXML extension, and when the XML file is
saved on my computer I can retrieve the values from it
using XPath.
How can I get the values from the XML-file, so that I
can compare it with the value I set?
Code:
require 'watir'
require 'rexml/document'
include REXML
ie = Watir::IE.start("http://x.x.x.x/site.ssi")
# ie.show_all_objects
# change one value in the dropdown list
ie.select_listname,
"/Configuration/Audio/Inputs/Headset/Level").select_value("7")
puts "Value changed"
#saves
ie.linkid, "").fire_event("onclick")
# open another browser and get's the xml-file
ie2 =
Watir::IE.start("http://10.47.11.217/getxml?location=/Configuration/Audio/Outputs/Headset/Level")
doc = ie2.document()
#try to use XPath to retrieve the value
node =XPath.first( doc,
"*/Configuration/Audio/Outputs/Headset/Level").get_text.value
The last line gives an error in the xpath_parser
(method_missing)
Hope someone can help me
-espen-
___________________________________________________________
Yahoo! Messenger - NEW crystal clear PC to PC calling
worldwide with voicemail http://uk.messenger.yahoo.com
___________________________________________________________
How much free photo storage do you get? Store your holiday
snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com
for web pages. To control the test results I retrieve
information from the same web page, but I get the
information from a XML-file.
I use the REXML extension, and when the XML file is
saved on my computer I can retrieve the values from it
using XPath.
How can I get the values from the XML-file, so that I
can compare it with the value I set?
Code:
require 'watir'
require 'rexml/document'
include REXML
ie = Watir::IE.start("http://x.x.x.x/site.ssi")
# ie.show_all_objects
# change one value in the dropdown list
ie.select_listname,
"/Configuration/Audio/Inputs/Headset/Level").select_value("7")
puts "Value changed"
#saves
ie.linkid, "").fire_event("onclick")
# open another browser and get's the xml-file
ie2 =
Watir::IE.start("http://10.47.11.217/getxml?location=/Configuration/Audio/Outputs/Headset/Level")
doc = ie2.document()
#try to use XPath to retrieve the value
node =XPath.first( doc,
"*/Configuration/Audio/Outputs/Headset/Level").get_text.value
The last line gives an error in the xpath_parser
(method_missing)
Hope someone can help me
-espen-
___________________________________________________________
Yahoo! Messenger - NEW crystal clear PC to PC calling
worldwide with voicemail http://uk.messenger.yahoo.com
___________________________________________________________
How much free photo storage do you get? Store your holiday
snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com