Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
avatar
mylogin99
Posts : 3
Join date : 2012-01-24

Selenium IDE and Selenium Webdriver incompatibility. Empty Selenium IDE and Selenium Webdriver incompatibility.

Thu Jan 26, 2012 6:35 pm
Hello.
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
avatar
man2auto
Posts : 1
Join date : 2012-01-30

Selenium IDE and Selenium Webdriver incompatibility. Empty Re: Selenium IDE and Selenium Webdriver incompatibility.

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

@BeforeClass

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.
avatar
qappbc
Amateur
Amateur
Posts : 38
Join date : 2011-10-13

Selenium IDE and Selenium Webdriver incompatibility. Empty Re: Selenium IDE and Selenium Webdriver incompatibility.

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.
Sponsored content

Selenium IDE and Selenium Webdriver incompatibility. Empty Re: Selenium IDE and Selenium Webdriver incompatibility.

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