.getCurrentUrl() 編集を提案する
現在のページのURLを取得します。
使用方法
.getCurrentUrl([callback])
例
describe('Navigation commands demo', function() {
test('demoTest', function(browser) {
// navigate to new url:
browser.navigateTo('https://nightwatch.dokyumento.jp');
// Retrieve to url with callback:
browser.getCurrentUrl(function(result) {
console.log(result.value);
});
});
test('demoTestAsync', async function(browser) {
const currentUrl = await browser.navigateTo('https://nightwatch.dokyumento.jp').getCurrentUrl();
console.log('currentUrl:', currentUrl); // will print 'https://nightwatch.dokyumento.jp'
});
});
パラメータ
名前 | 型 | 説明 |
---|---|---|
callback オプション |
関数 |