Page Objects
web.init();
web.open('https://www.wikipedia.org/');
web.type('id=searchInput', 'selenium');
web.select('id=searchLanguage', 'label=English');
web.click('//*[@id="search-form"]/fieldset/button');
web.assertText('id=firstHeading', 'Selenium');var po = require('./po.js');
web.init();
web.open('https://www.wikipedia.org/');
web.type(po.homePage.searchInput, 'selenium');
web.select(po.homePage.languageSelect, 'label=English');
web.click(po.homePage.goButton);
web.assertText(po.searchResultScreen.mainTitle, 'Selenium');This will work the same without require
web.init();
web.open('https://www.wikipedia.org/');
web.type(po.homePage.searchInput, 'selenium');
web.select(po.homePage.languageSelect, 'label=English');
web.click(po.homePage.goButton);
web.assertText(po.searchResultScreen.mainTitle, 'Selenium');Page object video tutorial
Last updated
Was this helpful?