new to selenium-webdriver, switching from one window to another -
currently have started use selenium 2.0/web-driver automation testing company work for.
currently have 20 tests developed testing, when run tests open new browser window each test.
unfortunately though need new user registration/login info executed in first test used in rest of tests since i'm testing webstore/shopping cart.
my question is, there way either stop having new browser windows opening or close window , place focus first window new user registered , logged in? through doing research before writing question here found out
driver.getwindowhandles();
which have being run in registration test case ,
driver.switchto().window("handle");
have being run in second test case , thought should have put focus first window.
i'm using driver.close();
close additional windows being created, prefer don't open in first place.
if understand question correct need - add procedure @before annotation , inside procedure open driver. add procedure @after annotation , close driver. inside tests (with @test annotation) need use driver.get. in case new windows not opened.
Comments
Post a Comment