selenium-ide icon indicating copy to clipboard operation
selenium-ide copied to clipboard

How to use SeleniumIDE Events?

Open jiankafei opened this issue 2 years ago • 3 comments

Can you provide a complete example of how to use SeleniumIDE Events? For example, how do I register for the commandRecorded event? Where to register? How does it communicate with SeleniumIDE?

jiankafei avatar Apr 04 '23 09:04 jiankafei

I thought you'd never ask:

https://github.com/SeleniumHQ/selenium-ide/tree/trunk/packages/side-example-suite

There is a plugin in the plugins folder that does a lot of these subscriptions. Plugins can be added at the project and can take absolute paths, node modules, or relative paths (from where project is located)

Let me know if this doesn't do much for you and I can try to provide more.

toddtarsi avatar Apr 04 '23 13:04 toddtarsi

@toddtarsi I saw the sample code, but I still don't know how to use these events because I'm not sure where the entry point for using these codes is. Or rather, how do I use this code. I need a complete project example using events, not a code snippet. The complete project will let me know where I should write this code and the completion process for the event to take effect. Perhaps a complete tutorial on how to use events is necessary.

jiankafei avatar Apr 17 '23 02:04 jiankafei

@jiankafei - I agree, but for now, I'll just try to help a bit more. Maybe if I help you, you can write the tutorial after all 😃

So, there is a project in that folder, projects/plugin.side. Open that in Selenium IDE v4, and go to the config pane. There, you should see the following entry in the plugins section.

../dist/plugins/custom-click/index.js

Plugins can be resolved in three ways:

  1. Via node_modules: @seleniumhq/side-example-plugin. This isn't a real plugin, but this example gives you some idea. I could split the code up quite easily to make this an actual npm package too.
  2. Via an absolute url: '/home/jiankafei/my-plugins/plugin.js'
  3. Via a relative url, which will be resolved w/r/t the project directory: '../dist/plugins/custom-click/index.js'

From there, the file will be parsed on project load.

toddtarsi avatar Apr 17 '23 16:04 toddtarsi