问题
I have an application that for one of its pages returns an XML string (type text/xml). The result is returned "inline" so that when I load that page in Firefox I see the XML string.
I want to use the Selenium IDE plugin in Firefox to verify that some text is present on this page. However, when I try to do this with the VerifyTextPresent
command I get the error Couldn't access document.body. Is this HTML page fully loaded?
.
Is it even possible to do this kind of check in Selenium on XML output? If so, how?
Here is a snippet of what the page produces:
<?xml version="1.0"?>
<alerts time_generated="2011-01-20 20:34:01" version="2.00" time_generated_epoch="1295584441">
<alert>
<client_updates/>
<contact_firstname>Brian</contact_firstname>
...
回答1:
Selenium does not natively support verifying text present in an XML page. However, there is an assertTextPresentXML extension available.
来源:https://stackoverflow.com/questions/4755436/can-selenium-ide-verify-text-on-an-xml-page