selenium ide export to webdriver java
The "Java - WebDriverBackedSelenium" exporter I found generates code like this: selenium.open("/"); selenium.type("Password", "blah"); etc..
But I need it to export like the classic WebDriver example below:
driver.get("http://www.google.com");
WebElement element = driver.fin开发者_Python百科dElement(By.name("q"));
element.sendKeys("Cheese!");
is there a way to export to the 2nd option? I'm being asked to use this, and have used the ide to get the page id tags in the past, it would be nice to export to this format if possible. Does anyone know or have any opinions on this?
You can export the recorded Selenium tests as "JUnit 4 (WebDriver)" tests instead of "JUnit 4 (WebDriver Backed)" tests, if you need to use the WebDriver
API class alone and not Selenium
class in your tests.
PS: It would also help to use a more up to date version of the Selenium IDE; v.1.2.0 (which is the most recent version of the IDE as of now) definitely supports exporting tests cases to use the WebDriver API.
Whilst on the IDE do the following...
- Click File
- Export Test Case As...
- Select Java / TestNG / WebDriver
- Give the file a name, and ensure you put .java at the end of it e.g. test.java
精彩评论