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
3529
3529
{
3530
3530
$ currentTab = $ this ->webDriver ->getWindowHandle ();
3531
3531
$ 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 ' );
3535
3534
}
3535
+ $ this ->webDriver ->close ();
3536
+ $ this ->webDriver ->switchTo ()->window ($ prevTab );
3536
3537
}
3537
3538
3538
3539
/**
Original file line number Diff line number Diff line change @@ -1028,7 +1028,6 @@ public function testBrowserTabs()
1028
1028
$ this ->module ->closeTab ();
1029
1029
$ this ->module ->seeNumberOfTabs (2 );
1030
1030
$ this ->module ->closeTab ();
1031
- $ this ->module ->closeTab ();
1032
1031
}
1033
1032
1034
1033
public function testPerformOnWithArray ()
You can’t perform that action at this time.
0 commit comments