2

In my test case i want to check weather a checkbox is already checked or not.

If not checked then i will not proceed else i will proceed.

here is the code

  <tr>

             <td>storeValue</td>

           <td>//div[@id='insurance_type_selected']/div[@class='prod_type_list']/p[@class='groupTtl']/label[@for='prod_insurance_types_1']/input[@type='checkbox']/</td>
        <td>val</td>

    </tr>


    <tr>    

         <td>echo</td>
         <td>${val}</td>
         <td></td>
    </tr>

    <tr>

        <td>gotoIf</td>

        <td>storedVars['val']=='on'</td>

        <td>true</td>
    </tr>

During execution this error is showing

[info] Executing: |gotoIf | storedVars['val']=='on' | true |

[error] Unknown command: 'gotoIf'

What is causing this error?

John
  • 700
  • 3
  • 17
  • 30

3 Answers3

2

Selenium IDE doesn't support gotoif command, that's why you are getting error Unknown command: 'gotoIf'

To use gotoif command in selenium IDE, you need to import file. You can get that file from HERE

You can have a look HERE for reference.

Also have a look on Xpath to determine checkbox "checked" attribute in Selenium IDE

Community
  • 1
  • 1
Rohit Ware
  • 1,982
  • 1
  • 13
  • 29
  • I downloaded the files to my desktop and unzipped them. after that i opened the selenium ide and through Options > options > selenium core extension i uploded the file goto_sel_ide.js during executing my test case through ide i got the following error [error] Unexpected Exception: fileName -> chrome://selenium-ide/content/tools.js -> file:///C:/Users/Neil/Desktop/New%20folder/goto_sel_ide.js?1348644882283, lineNumber -> 90 Can u please tell me how can i remove this error and what wrong i have done . – John Sep 26 '12 at 07:41
  • I am using Selenium IDE 1.9.0 version. – John Sep 26 '12 at 07:44
  • using which file in that?? Use goto_sel_ide.js file only – Rohit Ware Sep 26 '12 at 13:11
  • This happened to me recently. I found, open of the add-on is missing - Selenium Flow Control. After installing this, it worked. – Bimal Poudel Jan 14 '15 at 10:37
0
if (assertChecked(label="prod_insurance_types_1")) {
    assertTrue(False) // this way it would fail and don't proceed
} else {
    // do sth

Something like this should work as far as I remeber

bognix
  • 201
  • 1
  • 6
  • I have used bot If and if but in both cases it is showing [error] Unknown command: 'If' or [error] Unknown command: 'if' can u tell me how to write in selenium ide – John Sep 24 '12 at 13:47
  • http://www.computerminds.co.uk/automating-boring-tasks-selenium-ide http://wiki.openqa.org/display/SEL/flowControl read this, maybe this would help – bognix Sep 24 '12 at 13:50
0

You need the Flow Control plugin, listed on the SeleniumHQ download page: http://docs.seleniumhq.org/download/#side_plugins

Direct link: https://addons.mozilla.org/en-US/firefox/addon/85794/

roymeo
  • 109
  • 3