新しいURLに移動します。このメソッドは、ページがロードされた直後に、onBrowserNavigate() テストグローバルも呼び出します。

使用法

                    .navigateTo(url, [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'
  });

});

パラメータ

名前 説明
url 文字列

移動先のURL

コールバック
オプション
関数

W3C WebDriver 仕様