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

Provide way to write extensions to the IDE

Open zavelevsky opened this issue 9 years ago • 11 comments

We need to provide a way to write extensions to the IDE, including:

  • adding more commands
  • modifying the element finder behavior
  • modifying the exported code

zavelevsky avatar Sep 18 '17 07:09 zavelevsky

I was thinking about maybe adding a <script> and providing a CDN where we sign the checksum of the extension using our extensions private key, to make sure no rogue javascript is ran

corevo avatar Sep 18 '17 07:09 corevo

https://developer.chrome.com/extensions/contentSecurityPolicy#relaxing-remote-script We can consider using a CDN that we manage, and load scripts using XMLHttpRequest -> eval ->chrome.tabs.executeScript

zavelevsky avatar Sep 18 '17 14:09 zavelevsky

We need to make a decision here. The way I see it, there are two options to support extensions to the IDE:

  1. Loading the scripts from a location on a remote server
  2. Extensions are part of the IDE

The way I see it, the only advantage of option #1 is that it doesn't require issuing a new version of the extension. It's a weak argument in Chrome - because it's a non-issue to publish a new version and it gets automatically updated. In Firefox it's more of a big deal as every version of an add-on requires approval (I hope it'll change for Web Extensions).

The rest is disadvantages:

  • it's a security hole
  • I have a feeling it will be more limited in the future - leading us to do it via a CDN that we manage
  • we have no supervision of the extensions
  • we will have to maintain versions so not to break extensions - I'm not sure how doable it is

I suggest we go with option #2: Everyone that wishes to write an addon to the IDE will have to do a PR that meets specific requirements and has to pass certain automated tests. This will allow us to review the code. In any case, extensions will be placed in a specific folder and have to use a specific API - their PR shouldn't contain code modifications to the IDE. An extension isn't loaded if the user hadn't chosen it from a list of optional extensions.

@shs96c , @corevo , @samitbadle

zavelevsky avatar Sep 19 '17 06:09 zavelevsky

What about:

  1. Load scripts from a local server?

On 19 Sep 2017, at 07:00, Doron Zavelevsky [email protected] wrote:

We need to make a decision here. The way I see it, there are two options to support extensions to the IDE:

Loading the scripts from a location on a remote server Extensions are part of the IDE The way I see it, the only advantage of option #1 is that it doesn't require issuing a new version of the extension. It's a weak argument in Chrome - because it's a non-issue to publish a new version and it gets automatically updated. In Firefox it's more of a big deal as every version of an add-on requires approval (I hope it'll change for Web Extensions).

The rest is disadvantages:

it's a security hole I have a feeling it will be more limited in the future - leading us to do it via a CDN that we manage we have no supervision of the extensions we will have to maintain versions so not to break extensions - I'm not sure how doable it is I suggest we go with option #2: Everyone that wishes to write an addon to the IDE will have to do a PR that meets specific requirements and has to pass certain automated tests. This will allow us to review the code. In any case, extensions will be placed in a specific folder and have to use a specific API - their PR shouldn't contain code modifications to the IDE. An extension isn't loaded if the user hadn't chosen it from a list of optional extensions.

@shs96c , @corevo , @samitbadle

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

samitbadle avatar Sep 22 '17 07:09 samitbadle

We have considered that, we were unsure of two things

  1. Like option 1, how likely is it to get banned from the extension store for running unapproved code
  2. How can we ensure the user's ability to install and serve these extensions, should we create a daemon that would automatically load extensions installed in a certain path? maybe use npm?

corevo avatar Sep 22 '17 08:09 corevo

On 22 Sep 2017, at 09:05, Tomer Steinfeld [email protected] wrote:

We have considered that, we were unsure of two things

Like option 1, how likely is it to get banned from the extension store for running unapproved code Shouldn't this depend on which context the unapproved code is running in? How can we ensure the user's ability to install and serve these extensions, should we create a daemon that would automatically load extensions installed in a certain path? maybe use npm? Would it be possible to have a standalone extension server that can serve these?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

samitbadle avatar Sep 22 '17 11:09 samitbadle

I think the problem is that they will be able to log the user's activity (which ironically is what we want) in an unsupervised manner.

And we could have a server running, but would it be too complex of an experience?

corevo avatar Sep 24 '17 07:09 corevo

  1. do it like GreaseMonkey is planning to do it - use an editor. We can allow the users to extend the functionality by pasting scripts. We will store the scripts in the local cache. It's a bit more effort for us UI-wise but seems like the better option. And if it's ok with FF for GreaseMonkey and for Chrome with TamperMonkey then we should be OK.

zavelevsky avatar Sep 25 '17 07:09 zavelevsky

The company I work for has been working toward an automated testing infrastructure that uses SeleniumIDE to allow now programmers to create testing scripts. We have a very unique and complex application framework that has required us to build custom locator strategies. These locators integrate with our application framework to make locator values that are more robust than the built in locator strategies. This is largely solving a problem created by our application and how it generates HTML and not an issue with how the built-in locator strategies work.

Option 2 proposed by zavelevsky wouldn't work well for us as our locator strategy would not be useful to anyone outside of our company. So we would be in favor of any extension mechanism that lets us load our extensions without needing to pull them into the IDE itself or fork the IDE and maintain our own copy.

Setting up a local webserver to host the extensions on a predefined local port would work for us, as, while we are targeting non-programmers, the users will be very capable of installing/configuring software on the devices used for creating test scripts.

Saving the scripts into local storage by providing an interface for adding script text would work as well assuming the scripts wouldn't be wiped out by a casual clearing of browser data.

Another alternative could be to design an interface that would allow SeleniumIDE extensions/add-ons to be published as standalone webextensions. They can then install their own content scripts and register themselves with the seleniumIDE extension using inter-extension messaging. This would probably only work for a limited set of possible extensions but might work well for adding locator strategies.

Edit:
I just thought of another possibility for our use case. We can include our locator extension in the script of the website being tested. So if an interface could be defined that would allow the target page to provide a locator strategy then that would work for our use case.

jeremybramwell avatar Sep 26 '17 19:09 jeremybramwell

Just another example of local + remote + update plugin https://github.com/openstyles/stylus

nschonni avatar Jan 19 '18 21:01 nschonni

Fixed will be included in 3.1.0

corevo avatar Jun 19 '18 12:06 corevo