File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -3456,10 +3456,11 @@ public function closeTab()
34563456 {
34573457 $ currentTab = $ this ->webDriver ->getWindowHandle ();
34583458 $ prevTab = $ this ->getRelativeTabHandle (-1 );
3459- $ this ->webDriver ->close ();
3460- if ($ prevTab !== $ currentTab ) {
3461- $ this ->webDriver ->switchTo ()->window ($ prevTab );
3459+ if ($ prevTab === $ currentTab ) {
3460+ throw new ModuleException ($ this , 'Will not close the last open tab ' );
34623461 }
3462+ $ this ->webDriver ->close ();
3463+ $ this ->webDriver ->switchTo ()->window ($ prevTab );
34633464 }
34643465
34653466 /**
Original file line number Diff line number Diff line change @@ -1039,7 +1039,6 @@ public function testBrowserTabs()
10391039 $ this ->module ->closeTab ();
10401040 $ this ->module ->seeNumberOfTabs (2 );
10411041 $ this ->module ->closeTab ();
1042- $ this ->module ->closeTab ();
10431042 }
10441043
10451044 public function testPerformOnWithArray ()
You can’t perform that action at this time.
0 commit comments