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 @@ -3507,10 +3507,11 @@ public function closeTab(): void
35073507 {
35083508 $ currentTab = $ this ->webDriver ->getWindowHandle ();
35093509 $ prevTab = $ this ->getRelativeTabHandle (-1 );
3510- $ this ->webDriver ->close ();
3511- if ($ prevTab !== $ currentTab ) {
3512- $ this ->webDriver ->switchTo ()->window ($ prevTab );
3510+ if ($ prevTab === $ currentTab ) {
3511+ throw new ModuleException ($ this , 'Will not close the last open tab ' );
35133512 }
3513+ $ this ->webDriver ->close ();
3514+ $ this ->webDriver ->switchTo ()->window ($ prevTab );
35143515 }
35153516
35163517 /**
Original file line number Diff line number Diff line change @@ -1027,7 +1027,6 @@ public function testBrowserTabs()
10271027 $ this ->module ->closeTab ();
10281028 $ this ->module ->seeNumberOfTabs (2 );
10291029 $ this ->module ->closeTab ();
1030- $ this ->module ->closeTab ();
10311030 }
10321031
10331032 public function testPerformOnWithArray ()
You can’t perform that action at this time.
0 commit comments