Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Selenium in Java, how to getText() of a complicated element? consider following case: What is Max 's age? I am comparing it with

Using Selenium in Java, how to getText() of a complicated element?

consider following case:

"What is "

"Max"

"'s age?"

I am comparing it with the file that contains the same label "What is Max's age".

The developer have made it this way because the name "Max", changes depending on user's first name. Following is the xpath I have used to locate, "//h1[@class = "label-heading"], this works but is there a way I can call the label without using class name and h1. I have tried, "//*[text() = "What is Max's age"]. This does not work as the text in html is in 3 separate line but is there an alternative way I could get the label without using class name and h1?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Fred R. McFadden, Jeffrey Slater, Mary B. Prescott

5th Edition

0805360549, 978-0805360547

More Books

Students also viewed these Databases questions

Question

How is a futures contract priced?

Answered: 1 week ago