Closed jumperchen closed 12 years ago
Would you be able to provide an example script that causes this behavior?
I used the "Emulating Selenium RC" from the document - http://seleniumhq.org/docs/03_webdriver.html For example, (similar this)
Selenium selenium = new WebDriverBackedSelenium(driver, baseUrl); // Perform actions with selenium selenium.open(url); selenium.getText("some locator we customized!"); // causes an exception.
so it will throw an exception from the customized locator, but it will run with the following code instead.
finder.findElement(driver, locator);
In this case, we customized the finder to find the specific locator for our framework.
You can also refer to this implementation of GetText.java - http://code.google.com/p/selenium/source/browse/trunk/java/client/src/org/openqa/selenium/internal/seleniumemulation/GetText.java?spec=svn11411&r=11411
Would you be able to provide me with a reproducible test case for this? I've never used Selenium RC styled locators before. Can you share the customized locator you have that fails with OperaDriver with me?
is this not good enough?
Selenium selenium = new WebDriverBackedSelenium(driver, baseUrl); // Perform actions with selenium selenium.open(url); selenium.getText("some locator we customized!"); // causes an exception.
Can you specify what "some locator we customized" is?
please refer to these class - https://github.com/zkoss/ztl/blob/master/ztl/src/main/java/org/zkoss/ztl/util/Scripts.java https://github.com/zkoss/ztl/blob/master/ztl/src/main/java/org/openqa/selenium/internal/seleniumemulation/ZKElementFinder.java https://github.com/zkoss/ztl/blob/master/ztl/src/main/java/org/openqa/selenium/internal/seleniumemulation/ZKGetText.java if the getText() method is triggered from our client script, it won't work with Opera driver so that we have to get the element from our finding script before getText.js from the opera driver, you can also check the ZKGetText.java to see how we get around of the issue.
We've decided not to support Selenium 1 backwards-compatibility.
In the org.openqa.selenium.internal.seleniumemulation.GetText#handleSeleneseCommand() method, if the WebDriverException happened, it will use finder.findElement() to receive the element again, but in OperaDriver, it will close the connection when the exception happened.
The exception will cause at com.opera.core.systems.ScopeServices#executeCommand(),
For example,
connection.send(commandBuilder.build());
Note that the connection in this case is null.