If command on <tr class="empty"

Scenario
If table on page has data - then click call to action
If table on page does not have data - refresh the page

I attempted to do the following- Did not work
Command: if
Target: I used the select to highlight this

Nothing found to display. but couldn’t add an operator to finish the statement.

When my table has data it has a class=“odd” value
When my table does not have data it has a class value=“empty”

Try this: Search and Extract page source code - Selenium IDE Commands Tutorial

Thanks!
Just to be clear…

To validate if the table has no content I can say
Command: Click Target: Page
Command: sourceSearch Target: Empty=tr class
Command: Click Target: select Refresh page button

To validate that the table does have content I can say
Command: Click Target: Page
Command: sourceSearch Target: Odd=tr class
Command: Click Target: select next button

Look the source when it’s empty and copy selection including open and close tags to sourceSearch target field. Value is your var.
If var is 0 there is some content. When its not 0 (1) there is no content.

Dear commensal,

I tried your suggestion and it worked to activate the refresh button when the value is set to empty but we couldn’t activate the second option which is if the value doesn’t equal empty that the macro should follow the rest of the flow and click on the call to action.
Macro JSON
Json
{
“Name”: “new test”,
“CreationDate”: “2018-12-6”,
“Commands”: [
{
“Command”: “open”,
“Target”: “website address”,
“Value”: “”
},
{
“Command”: “sourceSearch”,
“Target”: “<tr class="empty">”,
“Value”: “empty”
},
{
“Command”: “click”, (refresh button)
“Target”: “/html/body/form/table/tbody/tr[2]/td/table[3]/tbody/tr/td/table[4]/tbody/tr[1]/td/img[3]”,
“Value”: “”
},
{
“Command”: “clickAndWait”, (quick pick button- for the second flow if class doesn’t = “empty”
“Target”: “/html/body/form/table/tbody/tr[2]/td/table[3]/tbody/tr/td/table[4]/tbody/tr[1]/td/img[3]”,
“Value”: “”
},

Playing if class=empty refresh page ERROR When we made the value 0 we got the following error

  • [info]
    Executing: | open | https://website address | |
  • [info]
    Executing: | sourceSearch | <tr class=“empty”> | 0 |
  • [error]
    Invalid variable name ‘0’. A variable name must start with a letter or the underscore character.
  • [info]
    Macro failed (Runtime 3.46s)
  • [status]

Playing if class=empty refresh page SUCCESSFUL - When we made the value “empty” it worked so does that mean if class!=“empty” that the other steps in the macro will be executed? How do we activate the second flow of steps if the class!=“empty”?

  • [info]
    Executing: | open | website address | |
  • [info]
    Executing: | sourceSearch | &lt;tr class="empty"&gt; | empty |
  • [info]
    Executing: | click | /html/body/form/table/tbody/tr[2]/td/table[3]/tbody/tr/td/table[4]/tbody/tr[1]/td/img[3] | 1 |
  • [info]
    Macro completed (Runtime 3.33s)
  • [status]

Playing macro 2nd lead_new test ERROR

  • [info]
    Executing: | open | https://website address | |
  • [info]
    Executing: | sourceSearch | &lt;tr class="empty"&gt; | empty |
  • [info]
    Executing: | click | /html/body/form/table/tbody/tr[2]/td/table[3]/tbody/tr/td/table[4]/tbody/tr[1]/td/img[3] | |
  • [error]
    timeout reached when looking for element ‘/html/body/form/table/tbody/tr[2]/td/table[3]/tbody/tr/td/table[4]/tbody/tr[1]/td/img[3]’

I don’t see in your code any conditional operator. I tried to realize this code but it’s a mess.
First error is because you have to use variable. 0 (zero) is not a variable. You cannot assign value to a zero. It works other way.
Second success is just a coincidence. sourceSearch is not conditional operator. It just searches for a piece of code and assign the number of times of found code in the source to a variable.
Third error is the opposite of the second success.

I guess you just have to improve your skill on programming in complex. This is not just finding the right command to work with. Read docs thoroughly with examples. This helps a lot.