Advertisement
Guest User

Untitled

a guest
Sep 28th, 2017
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. I am using selenium-html-js-converter to convert a seleniumIDE test case into nodeJS, the conversion works without error but I get this error when I try to run the output. I have tried a couple of versions of node and a couple of different tests but always get the same result.
  2.  
  3. ../node-v6.11.3-linux-x64/bin/node ./run.js
  4. /home/james/node_modules/make-sync/node_modules/fibers/future.js:280
  5.                                                 throw(ex);
  6.                                                 ^
  7.  
  8. Error: Failure in Selenium command "type("id=uh-search-box", "selenium")": [elementById("uh-search-box")] Not JSON response (Screenshot was saved to screenshots/test_outfile/Exception@type.png)
  9.     at exports.newError (/home/james/node_modules/wd/lib/utils.js:139:13)
  10.     at /home/james/node_modules/wd/lib/callbacks.js:56:17
  11.     at /home/james/node_modules/wd/lib/webdriver.js:169:5
  12.     at Request._callback (/home/james/node_modules/wd/lib/http-utils.js:78:7)
  13.     at Request.self.callback (/home/james/node_modules/wd/node_modules/request/request.js:121:22)
  14.     at emitTwo (events.js:106:13)
  15.     at Request.emit (events.js:191:7)
  16.     at Request.<anonymous> (/home/james/node_modules/wd/node_modules/request/request.js:985:14)
  17.     at emitOne (events.js:101:20)
  18.     at Request.emit (events.js:188:7)
  19.     at IncomingMessage.<anonymous> (/home/james/node_modules/wd/node_modules/request/request.js:936:12)
  20.     at emitNone (events.js:91:20)
  21.     at IncomingMessage.emit (events.js:185:7)
  22.     at endReadableNT (_stream_readable.js:974:12)
  23.     at _combinedTickCallback (internal/process/next_tick.js:80:11)
  24.     at process._tickCallback (internal/process/next_tick.js:104:9)
  25.  
  26. Here is the convert script, yep its just two lines.
  27.  
  28. var converter = require("selenium-html-js-converter");
  29.  
  30. converter.convertHtmlFileToJsFile("./test.sel", "./outfile");
  31.  
  32. Here is the run script(run.js) which I use to run the output from the converter(outfile)
  33.  
  34. var wdSync = require('wd-sync');
  35.  
  36. var client  = wdSync.remote('127.0.0.1', 8910); // phantomjs default wd port
  37. var browser = client.browser;
  38. var sync    = client.sync;
  39.  
  40. var test1 = require('./outfile');
  41.  
  42. sync(function(){
  43.     browser.init({ browserName: 'phantomjs' });
  44.     test1(browser);
  45.     browser.quit();
  46. });
  47.  
  48. here is the contents of the selenium IDE test case (test.sel)
  49. <?xml version="1.0" encoding="UTF-8"?>
  50. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  51. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  52. <head profile="http://selenium-ide.openqa.org/profiles/test-case">
  53. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  54. <link rel="selenium.base" href="http://search.emory.edu/search?btnG=Search&entqr=0&output=xml_no_dtd&ud=1&client=monitoring&oe=UTF-8&ie=UTF-8&proxystylesheet=monitoring&site=default_collection&numgm=5" />
  55. <title>search</title>
  56. </head>
  57. <body>
  58. <table cellpadding="1" cellspacing="1" border="1">
  59. <thead>
  60. <tr><td rowspan="1" colspan="3">search</td></tr>
  61. </thead><tbody>
  62. <tr>
  63.         <td>open</td>
  64.         <td>/search?btnG=Search&amp;entqr=0&amp;output=xml_no_dtd&amp;ud=1&amp;client=monitoring&amp;oe=UTF-8&amp;ie=UTF-8&amp;proxystylesheet=monitoring&amp;site=default_collection&amp;numgm=5</td>
  65.         <td></td>
  66. </tr>
  67. <tr>
  68.         <td>type</td>
  69.         <td>name=q</td>
  70.         <td>human resources</td>
  71. </tr>
  72. <tr>
  73.         <td>clickAndWait</td>
  74.         <td>name=btnG</td>
  75.         <td></td>
  76. </tr>
  77. <tr>
  78.         <td>verifyTitle</td>
  79.         <td>Search Results: human resources</td>
  80.         <td></td>
  81. </tr>
  82. </tbody></table>
  83. </body>
  84. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement