1


I've got some webpage and I'm looking for title tag with FindBy annotation (PageFactory.initElements is present in constructor of the class):

@FindBy(tagName = "title")
private WebElement titleTag;

After that I'm trying to get "some text" with WebElement method titleTag.getText(). The part of HTML code is common: <title>some text</title>. But I got absolutely no output - literally. Have tried to compare result with null, "", \n and even \0 - it's always false comparation.

1 Answer 1

1

There is no need to use @findBy for this. Just use driver.getTitle()

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.