This topic is locked
[SOLVED]

Changing Custom Button Label Using IF Statement

10/28/2021 7:22:31 PM
PHPRunner General questions
J
JoeB7774 author

Using the Client Before section, I am trying to change the value of the label of a button I'm pushing. I can get the value of the label of the label by using pageObj.getItemButton('Pay_button').text() but I can't get the IF statement to work (nothing changes when I push the button).

If (pageObj.getItemButton('Pay_button').text() == 'Show None')
{
$("span[data-itemid=Pay_button]").find("a").text("Show All");
}
Else
{
$("span[data-itemid=Pay_button]").find("a").text("Show None");
}

Any ideas? THanks in advance.

Sergey Kornilov admin 10/29/2021

You need to start by watching this video:

It explains how to step through your code, inspect variable values etc. This is the only way to troubleshoot an issue like this.

J
JoeB7774 author 10/29/2021

Thanks. The video was most helpful.