How do you get the value inside an XML document?

Michael_1031

In below XML I need to confirm "Internet" is there.

<section id="landing-content">
    <div id="header">
         <div class="container">
             <div class="row">
                 <div class="span12">
                     <h1 class="theme--primary">Internet</h1>
                 </div>
             </div>
         </div>
    </div>

I tried the following:

WebElement findInternet = driver.findElement(By.xpath("//h1"));
System.out.println(findInternet);
Richard

I think this will work for you:

WebElement findInternet = driver.findElement(By.cssSelector("h1.theme--primary"));
System.out.println(findInternet.getText());

Your xpath selector will probably work as well, the key thing you were missing is your println was printing the findInternet object. getText() will get the inner text of the selected element.`

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How do you get the selected value of a Spinner?

How to get the latest value from the JSON document inside MySQL column?

How do you change the value inside of a textfield flutter?

How do you get the document id after adding document in Cloud Firestore in Dart

How do you get the Node IP from inside a Pod?

How to get the value of an attribute inside an XML element in PHP?

How do you get the inner text inside these classes with javascript?

Mongodb: how do you set a field value inside a nested array

How do I get the text of an XML document when the node's attribute is equal to a certain value?

How to get a object value nested inside document in a collection in MongoDB PHP

How do you get a node that contains a child node with a given attribute value in an XML document using sql server?

How do you get djangorestframework to return xml using format suffix?

How do you get NSScrollView to center the document view in 10.9 and later?

Inside my own Angular service, how do you get the return value back to the Controller that called the service?

How do I get the value of this xml?

How do you get the value of a "embed"?

How do you print the value of an int inside square brackets in Java?

How do you get to the value inside of a python function that returns nothing for unit testing?

How to grep an XML tag and get only the value inside the quotes after it?

How do I get an object inside a document in Firestore

How to get the value from a XML Document

how do you get a specific value searched by a value in dataframes?

Java Xml document how to get attribute inside node

How do you get the value of an async operation inside a non-async function?

How do you update a value in a document in mongodb atlas?

How do you get the document id after adding document in Cloud Firestore in Dart after the new update

Using the 'document' function in XSLT, how do you get the value from the contents of the referenced document which is XML?

How do you get a newly generated random string inside a for loop

How to get the value of a specific tag inside XML