Unable to pass page object to a function in another file.
See original GitHub issueI have a file index.js where i have initialized the browser as below :
(async () => {
const browser = await _driver.launch
(
{
headless: false,
args: ['--start-maximized']
}
);
var page = await browser.newPage();
await page.setViewport({'width': 1366, 'height': 768 });
await page.goto('https://www.example.com/');
})();
Now i have another file homepage.js which contains the methods for manipulations on the homepage. This file used the page object initialized in index.js file. Im trying to pass the page object to the function of homepage.js bt it gives me UnhandledPromiseejectionWarning.
Issue Analytics
- State:
- Created 5 years ago
- Comments:14 (7 by maintainers)
Top Results From Across the Web
Cant we pass object to write function to add data in one file to ...
.write method of file object takes string type variable only as arguments. Passing it another file object will not work.
Read more >Stop using Page Objects and Start using App Actions - Cypress
In this post I argue that page objects are a bad practice, and suggest dispatching actions directly to the application's internal logic.
Read more >Page object operations - Provar
A page object operation is a custom function that is used to execute Java code on a page object within Provar.
Read more >Write a Selenium Java Test Suite Using Page Object Model
The first method, public Login(WebDriver driver), is a constructor that will run whenever a new instance of the class is created. This class...
Read more >Page Object Model In Playwright | LambdaTest - YouTube
Watch this video to learn about the Page Object Model (POM) design ... each web page of an application as a different class...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Something like this?
index.js
:homepage.js
:Output:
index.js
:puppeteer-utils.js
:Output: