wiki.techinc.nl/tests/selenium/wdio-mediawiki/Page.js
Željko Filipin 02b182d180 selenium: Fix and update links in comments and documentation
Bug: T324766
Change-Id: If62835494fe7dd47fc4f18b881783570340cb5a9
2024-02-15 16:12:25 +01:00

30 lines
701 B
JavaScript

'use strict';
const querystring = require( 'querystring' );
/**
* Based on https://webdriver.io/docs/pageobjects
*/
class Page {
/**
* Navigate the browser to a given page.
*
* @since 1.0.0
* @see <https://webdriver.io/docs/api/browser/url>
* @param {string} title Page title
* @param {Object} [query] Query parameter
* @param {string} [fragment] Fragment parameter
* @return {void} This method runs a browser command.
*/
async openTitle( title, query = {}, fragment = '' ) {
query.title = title;
await browser.url(
browser.config.baseUrl + '/index.php?' +
querystring.stringify( query ) +
( fragment ? ( '#' + fragment ) : '' )
);
}
}
module.exports = Page;