Forum Discussion
Hi,
Starting from Selenium 3, you will need to use GeckoDriver (add the following System Property):
System.setProperty("webdriver.gecko.driver", "C:/Program Files/SmartBear/ReadyAPI-2.3.0/bin/ext/geckodriver.exe");
How to use Firefox in Selenium using geckodriver in Selenium 3:
http://learn-automation.com/use-firefox-selenium-using-geckodriver-selenium-3/
http://www.automationtestinghub.com/selenium-3-0-launch-firefox-with-geckodriver/
But note that the versions of Selenium Server Standalone starting from 3.6 aren't compatible with an old version of the guava library which is used in ReadyAPI (guava-20.0.jar). To make it work, you will need to replace guava library file guava-20.0.jar with the guava-23.0.jar in this folder: C:\Program Files\SmartBear\ReadyAPI-2.3.0\lib. You can download the guava library version 23.0 from here: https://github.com/google/guava/wiki/Release23
Here is the sample script which you can use:
import org.openqa.selenium.By; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.WebElement; System.setProperty("webdriver.gecko.driver", "C:/Program Files/SmartBear/ReadyAPI-2.3.0/bin/ext/geckodriver.exe"); //Change the path def driver = new FirefoxDriver(); log.info("Go to the example page"); driver.get("http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/onclickEX1.htm"); log.info("Enter the 'Test' query string"); def query = driver.findElement(By.xpath("//*[@name='txtOutput']")); query.sendKeys("Test"); log.info("List the suggestions"); def allSuggestions = driver.findElements(By.xpath("//*[@name='txtOutput']")); log.info("Post the value of the element or an error if no elements with the appropriate value were found."); for (def suggestion : allSuggestions) { if(suggestion.getAttribute('value') != '') log.info(suggestion.getAttribute('value')); else log.error('The test failed.') } log.info("Now quit"); driver.quit();
Nice! Thank you Anastasia.
Yes, I knew it was a guava issue but I thought it would be the the one included in the libraries folder in the Webdriver download. I place all of them into the /ext directory. I grabbed the latest version on friday and placed it in /ext. Okay, I'll put a copy in /lib as you suggested.
Here is my issue. I can't work with just FF. I need IE and Chrome as well. I have a ticket for this that I entered last Dec. No one responded to my email last week, including our Account mgr/Customer success mgr, so I opened a new ticket today referrencing the original ticket.
Case #00293069 has been created: ReOpen Case #00271684: Ready_API Not Compatible Launching V62 Chrome Browser
Wait.....I forgot (Sorry, stream of consciousness)
I have Chrome defined with Options to support my network environmnet....I hate to describe this whole thing but there is a defect with chromediver.exe, where it attempts to install a browser plugin to controll the browser window. ITs not an issue for most people but in my network we have policy rules enforcing no browser plugins can me downloaded and installed if they are not whitelisted first. The folks at chromium were nice enough to provide the plugin ID, however it no longer exists as a download and whitlisting the ID doesn't help. They were supposed to remove the plugin and add it all to the Chrome Developer Tools but so far thats not happening so I'm stuck with the workaround, configuring the chrome option:
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("useAutomationExtension", false);
I need the equivilent for FF but I haven't been able to find it.... :-(
Thank you for your response.
Regards
Steve
- sprice0901617 years agoContributor
I installed guava-23.0.jar inthe \lib directory.
\ext has Selenium jars from v3.91, which uses guava-23.6-jre.jar
I get the Error: java.lang.NoSuchMethodError:com.google.gson.GsonBuilder.setLenient()Lcom/google/gson/GsonBuilder
Looks like another compatibility issue.
I get the same thing with the original guava-20
- sprice0901617 years agoContributor
Okay, I have this fixed.....for now.
As I mentioned above, I have local policy rule restrictions on top of the file compatibility issue.
The issue isn't the compatibility related to the \ext directory, it’s the files in the \lib directory. I'd like to know if there is a relationship between the two directories. We have similar files but different versions. So how are these directories used?
Solution: Replace \lib files "gson-2.3.1.jar", and "guava-20.0.jar"
with "gson-2.8.2.jar", and "guava-23.6-jre.jar" (from the Selenium 3.9 zip or whatever you are using)
Copy/Archive the \lib and \ext sub directories
Rename the installation directory to Ready_API_ORG
Run the Ready_API installer and perform a new install
(The v2.23 update feature caused me weeks of pain so I don't suggest using it at this time.)
Copy jar files to \ext Selenium(from the zip file), custom, sql ,and any others that you were using.
Copy the gson, and guava files from \ext and replace the ones in \lib.
This got rid of the various NoSuchMethodErrors for me. Now I had another connectivity error related to the options questions that I asked about above. I need the FF equivalent settings defined for Chrome.
I modified my groovy script to use Chrome again and the Chrome browser launched successfully.
Couple of thoughts:
I would caution telling folks to use FF as if it is the exclusive browser supported by SmartBear, unless that is in fact the case. May just say that you happen to be using FF for the purpose of your example. Ultimately we want our scripts to be able to perform cross browser testing.
One potential problem is maintaining the \ext directory with no guidance from SmartBear. I'm sure that I broke something out of ignorance. As I update selenium, I add the updated files to the directory. I don't really know what needs to be removed from the old files so I'll typically rename them. this makes for a mess, as I have Selenium, SQL, Custom and whatever jar files that I need to include in here.
My suggestion is to keep all files archived and given their own directories in the archive.
Related Content
- 9 years ago
Recent Discussions
- 18 days ago