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 @@ -3529,10 +3529,11 @@ public function closeTab(): void
35293529 {
35303530 $ currentTab = $ this ->webDriver ->getWindowHandle ();
35313531 $ prevTab = $ this ->getRelativeTabHandle (-1 );
3532- $ this ->webDriver ->close ();
3533- if ($ prevTab !== $ currentTab ) {
3534- $ this ->webDriver ->switchTo ()->window ($ prevTab );
3532+ if ($ prevTab === $ currentTab ) {
3533+ throw new ModuleException ($ this , 'Will not close the last open tab ' );
35353534 }
3535+ $ this ->webDriver ->close ();
3536+ $ this ->webDriver ->switchTo ()->window ($ prevTab );
35363537 }
35373538
35383539 /**
Original file line number Diff line number Diff line change @@ -1028,7 +1028,6 @@ public function testBrowserTabs()
10281028 $ this ->module ->closeTab ();
10291029 $ this ->module ->seeNumberOfTabs (2 );
10301030 $ this ->module ->closeTab ();
1031- $ this ->module ->closeTab ();
10321031 }
10331032
10341033 public function testPerformOnWithArray ()
You can’t perform that action at this time.
0 commit comments