How can verify page title

Like selenium IDE how i can verify page title against static text

Hi,
you can try use this:
WebUI.openBrowser(‘URL’)

WebUI.waitForPageLoad(5, FailureHandling.STOP_ON_FAILURE)

titleWindow = WebUI.getWindowTitle()
WebUI.verifyMatch(title, “ExpectedTitle”, true)

1 Like

It works, thanks Przemek

Hi Przemek,

I tried with above code but getting nothing from getWindowTitle() method.
I got below logs:
Unable to verify match between actual text ‘’ and expected text ‘Salesforce - Enterprise Edition’ using regular expression (Root cause: Actual text ‘’ and expected text ‘Salesforce - Enterprise Edition’ are not matched using regular expression)
Pls correct me where I’m lacking.

1 Like

I’ve found the workaround by creating local variables for expected and actual results in particular et case… With Global variables I also always get the error specified above

By the way, I also found out that ig save all Global Variables to Default Execution Profile then error during execution, described by Vivek Kumar, doesn’t apper

Vivek Kumar said:

Hi Przemek,

I tried with above code but getting nothing from getWindowTitle() method.
I got below logs:
Unable to verify match between actual text ‘’ and expected text ‘Salesforce - Enterprise Edition’ using regular expression (Root cause: Actual text ‘’ and expected text ‘Salesforce - Enterprise Edition’ are not matched using regular expression)
Pls correct me where I’m lacking.

Hi,

This error is because the expression you want to verify (windows title) is NOT a regular expression. You musn’t use regex (this must be to false in the parameters of keyword verifyMatch)

Regards,

Joeyxx

1 Like

To chime in, this should work just fine for you:

title = WebUI.getWindowTitle()
WebUI.verifyMatch(title, 'expectedPageTitleGoesHere', false)

That should get you what you are looking for to verify the Page Title.

1 Like

What is the difference between “, false” and ,“true” boolean statement? I notice both of those value passes the test?