Contributions
Re: Unable to run selenium code from grrovy script(SOAPUI)
Hello guys, I realize that this issue is a bit stale, but for the future generations I would like to say that that I have successfully solve it (and by the way thanks, previous comments were of great help to me). So to sum up: 1. Replace the following libraries under %SOAPUI_HOME%/lib (I simply moved out the old ones to an archive subfolder): guava, httpcore, httpclient (and in future you will probably have to replace more, cause the libs are pretty old) 2. Do not try to implement selenium script from a groovy test step, contrary to whatever is said on the selenium site, selenium is quite a tricky and unstable thing and it needs a lot of configuration and tweaking. This is not something a sane person would do, the work is enormous. Personally I converted a driver helper class from my old TAF which already supported detecting of a browser type & profiles, os platform etc 3. Assuming you can run your new lib with, say, Eclipse, you can now export it as a runnable jar. You need the option called "copy required libraries into a sub-folder next to the generated jar". When done you copy your new runnable jar + the libraries into %SOAPUI_HOME%/bin/ext. NOTE: Do not copy libs as a folder, but as a set of files, they need to be on the same level as your runnable jar. 4. Having failed to reliably reference selenium driver binaries from within the lib, I decided to keep them separately and take their location as a mandatory parameter when my lib starts. I guess, you'd better do the same 5. Finally, you need to write something like this in your groovy script (syntax heavily depends on whatever I have in my lib): // this one imports my lib import app.helpers.* def dhelper = new app.helpers.DriverHelper() log.info("Library status: " + dhelper.healthCheck()) // these, of course can be parameterized def browser = "FF" def pathToSelenium = "C:\\work\\seleniums" log.info(browser) log.info(pathToSelenium) def wd = dhelper.getDriverInstanceByName(browser, pathToSelenium) wd.get("http://google.com") Hope this helps. This worked for me.1.6KViews1like0Comments