Skip to content

Conversation

ThomasLandauer
Copy link
Member

@ThomasLandauer
Copy link
Member Author

The anchor is OK, so the above TODO is done.

*
* ###
*
* You can switch between browsers inside your code by injecting `\Codeception\Scenario` into your test like this:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence doesn't make sense to me.

In order to change browsers you have to use

$this->getModule('WebDriver')->_restart(['browser' => $browser]);

as documented at https://codeception.com/docs/modules/WebDriver#_restart

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea was to show some example for scenario, see Codeception/Codeception#6035 (comment) - and I couldn't think of another use case as switching the browser ;-)

I now added your line - but will $this->getModule(...) work from within a test at all? Or do I have to think of another use case...?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getModule method is not accessible in test code, it can only be used in helpers.

ThomasLandauer added a commit to ThomasLandauer/module-webdriver that referenced this pull request Mar 16, 2021
@ThomasLandauer
Copy link
Member Author

I deleted my fork, so I had to start from scratch :-) See #65

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants