-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No browser object is available for BeforeAll hooks on using cucumber #3038
Comments
|
As far as I know, the |
No further info was provided so closing. Please reopen a new issue with the relevant info |
@AutomatedTester @beatfactor @gravityvi Issue: No browser object is available for BeforeAll hooks when using Cucumber Description: I am encountering an issue where the Scenario: In my test setup, I need to fetch the user agent from the browser and update it before starting the test execution. To achieve this, I intend to use the Steps to Reproduce:
Expected Behavior: The Actual Behavior: The Example Code: const { BeforeAll, Before } = require('cucumber');
BeforeAll(async function() {
// Attempt to access the browser object and execute a command
const userAgent = await browser.execute(function() {
return navigator.userAgent;
});
// Update the user agent or perform other necessary actions
console.log('User Agent:', userAgent);
}); Request: It would be highly beneficial if the Thank you for your attention to this issue. I look forward to any suggestions or potential fixes. |
Describe the bug
No browser object is available for BeforeAll hooks on using cucumber. On using browser in before all hooks no test is executing.
Sample test
sampleTest.js
Run with command
Verbose output
debug.log
{
_: [],
c: 'config/nightwatch.webdriver.cucumber.conf.js',
config: 'config/nightwatch.webdriver.cucumber.conf.js',
browser: 'chrome',
env: 'chrome',
e: 'chrome',
reporter: 'junit',
r: 'junit',
'$0': 'C:\MyInstalledProgram\nodejs\node.exe C:\GartnerWorkspace\cpp_framework\cppdocs_v2.0\nightwatch.js',
_source: [],
format: [ 'json:reports/cucumber.json', '@cucumber/pretty-formatter' ]
}
Before All
Configuration
nightwatch.json
Your Environment
nightwatch --version
npm --version
node --version
The text was updated successfully, but these errors were encountered: