Closed saravananselvamohan closed 4 years ago
Window or document is not defined in Node environment, it is only defined in browser. You should try in the browser instead.
Thanks so much for your Answer @tyler8812 . So sideex-api code should be placed as chrome/firefox extension. Does it make the context right. Is there any options to run sideex-api as standalone server
@saravananselvamohan No, you don't need to placed in extension. Instead, you can placed in any browser you want. For example, create a HTML file and just load the js file that you write. Then you can start to use sideex-api.
Thanks @tyler8812. From your above suggestions I able to understand sideex-api can be able to placed within a webpage removing the constraints of running it in the browser extension. If you able to provide a few samples with placing sideex-api in a demo webpage that would be greatly helpful for the community and also those who starting new to sideex-api like me.
Thanks @saravananselvamohan . Thanks for your suggestion, I'm still writing an introduction about sideex-api, and it will also includes some examples and demos.
Hi @tyler8812. I am using this sample HTML file.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Spoon-Knife</title>
<LINK href="styles.css" rel="stylesheet" type="text/css">
</head>
<body>
<img src="forkit.gif" id="octocat" alt="" />
<!-- Feel free to change this text here -->
<p>
Fork me? Fork you, @octocat!
</p>
<p>
Sean made a change
</p>
</body>
</html>
I tried many ways to reference sideex-api, but I am struggling to get the appropriate way to use sideex-api
Hi @saravananselvamohan , the HTML file looks fine, but you have to load the js file inside the html,. For example: create a filename.js file
var {SideeX} = require('sideex-api')
var sideex = new SideeX();
sideex.recorder.start();//start recording
/*
Record a command
For example: click at anywhere on the window,
then you get a ClickAt command
*/
sideex.recorder.stop();//stop recording
console.log(sideex.file.command.get(0));//get the first recorded command
sideex.playback.start();//replay the recorded commands
and you have to build the js file, like using browserify: browserify filename.js -o bundle.js after this, inside your HTML, you can just load the js file that you built, type this in the HTML file
<script type="text/javascript" src="bundle.js"></script> //bundle.js is the js file that i built.
You can probably use the sideex-api~~
Thanks a ton for the help @tyler8812. I am able to get the events logging in the console. Thank you so much for such patience on helping me.
Hello,
I have similar problem. I know nodejs doesn't have window property but I want to launch a browser from js code (with selenium-webdriver maybe) and record user actions on this launched browser instance.
I saw html solutions above. Is there any other way to launch a browser and record it with sideex?
I am just trying to use sideex-api in my js file. I added Record & Playback example code in my js file. I tried to run the js file on top of node. It gave me the following error. Can someone help me with this.
I added logs here.