vmi / selenese-runner-java

Selenium IDE native format (selenese and side) interpreter.
Other
140 stars 83 forks source link

user-extensions.js #79

Open kornelc opened 11 years ago

kornelc commented 11 years ago

I am looking for a way to include the locators and commands in my user-extensions.js that I have created over time. In many projects these are very useful, even essential. Is there a way to do this? If you have support for this, could you show a tiny example of each and what I would need to do to make this work. Thanks!

vmi commented 11 years ago

It may be able to support your proposed feature if the following ticket is accepted. https://code.google.com/p/selenium/issues/detail?id=6479

Please show your example.

kornelc commented 11 years ago

I looked at it. Thank you for the pointer. I am struggling to find a solution for this that is open source. I know of one Selenese runner in Java that is probably full featured but it's part of SmartGWT commercial edition. That's an expensive library especially if I only want to use their Selenese runner, and none of the rest of the library for my particular project. I looked at your library because it looks like you put a lot of thought into it. So I will continue to keep an eye on your project in case this becomes possible. In the mean time I am trying to hack something together in Ruby just to be able to run my own scripts. I need to find a way to run them automated somehow. The reason why extensions are so important to me is because for AJAX apps the DOM constantly changes based on which widget gets built first and without user extensions it's very hard to create readable test cases.

Thanks for taking the time to look into this.

kornelc commented 11 years ago

Oh just to answer your question: My example is that I am trying to write locators and commands for the entire Dojo widget set. They have complex DOMs. Imagine if I just used one of the standard locators (such as xpath) to get to the right element within a widget in this library. Check out the library here: http://dojotoolkit.org/. It's an amazing toolkit but it's hard to write tests for it in Selenium, unfortunately. They have their own integration test tools, but they are not as mature and accepted as Selenium. If I come up with something reasonable in Ruby, I could share it with you so you could maybe use it to support Dojo with your Java tool...

evgeniysharapov commented 11 years ago

Is it possible to add commands from the user javascript on the fly by extending WeDriverCommandProcessor or CustomCommandProcessor ?

vmi commented 10 years ago

It is not possible because JavaScript code cannot call Java code in current Selenium API.

kornelc commented 10 years ago

I just wanted to follow up on this because I did a lot of research in order to port my user-extensions.js file, and I think this enhancement probably would not make sense for the following reasons: Unfortunately, with Selenium 2, Selenium Core (the Javascript API upon which user extensions are based) will be gone. They support it for backward compatibility. But it's a really bad idea to continue using 'old' style user extensions. From reading through the forums I get the impression that the Selenium folks want us to handwrite test cases in terms of the new web driver API, in our favorite language, instead of coding to the old Selenium Core API. The Dojo Foundation/Sitepen are working on a higher level library Intern to write tests to the web driver API, which makes it possible to use Dojo itself (since it is already in the page) to test Dojo apps. (Though it is supposed to work with other toolkits as well.) In addition they added closers 'promises/deferred objects' which, on top of web driver, specifically addresses the problem of testing asynchronous AJAX apps, where pieces of the screen load in unpredictable order. So in short user-extensions.js is obsolete. We should use web-driver, instead, or better yet, Intern from Sitepen: http://theintern.io/.

fiub commented 9 years ago

@vmi, it would be great if ticket https://code.google.com/p/selenium/issues/detail?id=6479 would be accepted since me too, as like as @kornelc said in https://github.com/vmi/selenese-runner-java/issues/79#issue-21873226, I've got a huge amount of js extensions in my seleniumIDE scripts

vmi commented 9 years ago

Hi,

I no longer need the ticket because I replaced it with my implementation. I am planning implement of user-extension.js again. However, I don't have any code of extensions, so it's very difficult. I would appreciate if you could provide some sample code of extensions.

vaskrist commented 9 years ago

A sample useful extension would be SelBlocks, where they already have a user-extensions.js compatible with Selenium server: https://raw.githubusercontent.com/refactoror/SelBlocks/master/user-extensions.js

I stumbled upon that when googling user extension support in Selenium server and clicked through to the following ticket: https://github.com/refactoror/SelBlocks/issues/10

timschlechter commented 9 years ago

+1

madoni commented 8 years ago

:+1: I plan on using some custom ui mapping ... something along these lines. ui-map.txt

reegen commented 7 years ago

SelBlocks would be really useful!

gbennett-manh commented 7 years ago

SeLite Selblocks Global is more current than SelBlocks and currently maintained FYI

fimash commented 7 years ago

Any news?

MrLukas007 commented 7 years ago

Really need to use functions from user-extensions.js. How we can do it?