Display results as :

Rechercher Advanced Search


Selenium IDE and Selenium Webdriver incompatibility.

View previous topic View next topic Go down

Selenium IDE and Selenium Webdriver incompatibility.

Post by mylogin99 on Thu Jan 26, 2012 6:35 pm

I've composed test suite in IDE which has two test cases inside. When I run this test suite in IDE test cases are being executed in the same browser window(without closing browser window after each test case and opening new one for next). Surprisingly, when i export test suite and test cases to Webdriver code, and then run my code , each test case of my test suite is being executed in a new window. After analyzing my java code(exported from IDE) I've noticed that for each test case new driver created(FirefoxDriver driver = new FirefoxDriver() ) and quited (driver.quit() ) at the end of test case, thats why new browser opens and exits for each test case.
So my questions:
1.Why there is such an incompatibility between IDE and Webdriver???
2. Can I modify my java code so that all my test cases be executed in the same window as in IDE ???
Thanks in advance. Smile


Posts : 3
Join date : 2012-01-24

Back to top Go down

Re: Selenium IDE and Selenium Webdriver incompatibility.

Post by man2auto on Mon Jan 30, 2012 7:16 pm

Actually you are right.

If you notice, in your java code, the "FirefoxDriver driver = new FirefoxDriver()" statement would be inside a method (called 'setUp' most probably). This method would have an "@Before" annotation.

So all you have to do is move this "FirefoxDriver driver = new FirefoxDriver()" statement to a method above it and make it a static method. Annotate that method with "@BeforeClass" annotation

for eg


public static void oneTimeSetup(){

"FirefoxDriver driver = new FirefoxDriver()"


Having the rest of the methods intact would be sufficient.

It would be good if you could paste a sample test class, So that we can see if anything more could be added.


Posts : 1
Join date : 2012-01-30

Back to top Go down

Re: Selenium IDE and Selenium Webdriver incompatibility.

Post by qappbc on Mon Jan 30, 2012 11:22 pm

It is because in exporting to the JUnit or TestNG framework that the annotation of @Before, etc. is included in the exported code. By design, it is assumed when selecting either of these export choices you would take advantage of them.

But it is not required to use those annotations. You could transfer needed code inside the annotation sections to the main body of your test case code and it would work as you want it to.


Posts : 38
Join date : 2011-10-13

Back to top Go down

Re: Selenium IDE and Selenium Webdriver incompatibility.

Post by Sponsored content Today at 6:39 am

Sponsored content

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

Permissions in this forum:
You cannot reply to topics in this forum