title: was(how to call javascript on robotframework) On robotframework, how to pass a string to variable which generated by javascript
body: <p>I am a green hand for coding. Here I want to use robotframework, selenium2library to test my company's software. I need to simulate click table operation.But there is a problem about the table's Xpath, it is dynamic, so I need to use java script to find the Xpath of table, then pass the xpath which generated by js to a variable, then "click element ${variable}"</p>
  
  <pre><code>*** Settings ***
  Library  Selenium2Library
  
  *** Variables ***
  
  
  *** Keywords ***
  Select added lsp
     Execute Javascript   variable=function getId(){
                          var  resultid = 'error';
                          $("#gridview-1275 table").each(function(){
                              var value = $(this).find('tr:eq(0)').find('td:eq(0)').text().replace(/(^\s*)|(\s*$)/g,'')+$(this).find('tr:eq(0)').find('td:eq(1)').text().replace(/(^\s*)|(\s*$)/g,'');
                              if(value=="222vmx102-11"){
                                  resultid = "//*[@id=\""+$(this).attr("id")+"\"]";
                                               }
                                                       });
                           return resultid;
                          }
  
   click element    ${variable}
  </code></pre>
  
  <p>but I got error,Here is the traceback:</p>
  
  <pre><code>&gt; 15:06:18.139  INFO    Executing JavaScript: variable=function getId(){    
  &gt; 15:06:18.141  DEBUG   POST
  &gt; http://127.0.0.1:63649/session/761829a0232d76a80dfb1dfce7546369/execute
  &gt; {"sessionId": "761829a0232d76a80dfb1dfce7546369", "args": [],
  &gt; "script": "variable=function getId(){"}    15:06:18.163   DEBUG   Finished
  &gt; Request    15:06:19.806   FAIL    WebDriverException: Message: unknown error:
  &gt; Runtime.evaluate threw exception: SyntaxError: Unexpected token ]
  &gt;     at Object.InjectedScript._evaluateOn (&lt;anonymous&gt;:875:140)
  &gt;     at Object.InjectedScript._evaluateAndWrap (&lt;anonymous&gt;:808:34)
  &gt;     at Object.InjectedScript.evaluate (&lt;anonymous&gt;:664:21)   (Session info: chrome=46.0.2490.86)   (Driver info: chromedriver=2.14.313457
  &gt; (3d645c400edf2e2c500566c9aa096063e707c9cf),platform=Windows NT 6.1 SP1
  &gt; x86_64) 15:06:19.807  DEBUG   Traceback (most recent call last):   File
  &gt; "&lt;string&gt;", line 2, in execute_javascript   File
  &gt; "C:\Python27\lib\site-packages\Selenium2Library\keywords\keywordgroup.py",
  &gt; line 15, in _run_on_failure_decorator
  &gt;     return method(*args, **kwargs)   File "C:\Python27\lib\site-packages\Selenium2Library\keywords\_javascript.py",
  &gt; line 97, in execute_javascript
  &gt;     return self._current_browser().execute_script(js)   File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py",
  &gt; line 423, in execute_script
  &gt;     {'script': script, 'args':converted_args})['value']   File "C:\Python27\lib\site-packages\Selenium2Library\webdrivermonkeypatches.py",
  &gt; line 11, in execute
  &gt;     result = self._base_execute(driver_command, params)   File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py",
  &gt; line 195, in execute
  &gt;     self.error_handler.check_response(response)   File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py",
  &gt; line 170, in check_response
  &gt;     raise exception_class(message, screen, stacktrace)
  </code></pre>