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
3507
3507
{
3508
3508
$ currentTab = $ this ->webDriver ->getWindowHandle ();
3509
3509
$ 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 ' );
3513
3512
}
3513
+ $ this ->webDriver ->close ();
3514
+ $ this ->webDriver ->switchTo ()->window ($ prevTab );
3514
3515
}
3515
3516
3516
3517
/**
Original file line number Diff line number Diff line change @@ -1027,7 +1027,6 @@ public function testBrowserTabs()
1027
1027
$ this ->module ->closeTab ();
1028
1028
$ this ->module ->seeNumberOfTabs (2 );
1029
1029
$ this ->module ->closeTab ();
1030
- $ this ->module ->closeTab ();
1031
1030
}
1032
1031
1033
1032
public function testPerformOnWithArray ()
You can’t perform that action at this time.
0 commit comments