JbrowserDriver'未找到元素'

时间:2017-08-21 08:12:46

标签: java selenium selenium-chromedriver

我尝试在此网址上使用JBrowserDriver:https://dtube.video/login

但我收到'未找到元素'错误。

从JBrowserDriver检索的源似乎与浏览器中的源不同。

浏览器中的来源:

 <div class="ui stacked segment">
      <div class="field">
        <div class="ui left icon input">
          <i class="user icon"></i>
          <input type="text" name="username" placeholder="STEEM Username">
        </div>
      </div>
      <div class="field">
        <div class="ui left icon input">
          <i class="lock icon"></i>
          <input type="password" name="privatekey" placeholder="Private Posting Key">
        </div>
      </div>
      <button type="submit" name="button" class="ui fluid large youtube submit button"><i class="sign in icon"></i> Login</button>
     </div>

JBrowser中的来源:

<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <link rel="stylesheet" type="text/css" class="__meteor-css__" href="/DTube_files/29075beddedc83e6624259c063f240421e6130cd.css?v=0815201">  <link rel="stylesheet" type="text/css" class="__meteor-css__" href="/DTube_files/9c9869ad5b7ba8f1336853c92e4abfeaa7a6595b.css?v=08192017">
      <link rel="shortcut icon" type="image/png" href="https://ipfs.io/ipfs/QmRvVAjRHXqZvBGKG67qxDamjd2EiHngdddL4C8GFTKACf">
    <title>DTube</title>

    </head>
    <body>
      <script type="text/javascript">__meteor_runtime_config__ = JSON.parse(decodeURIComponent("%7B%22meteorRelease%22%3A%22METEOR%401.4.4.1%22%2C%22meteorEnv%22%3A%7B%22NODE_ENV%22%3A%22production%22%2C%22TEST_METADATA%22%3A%22%7B%7D%22%7D%2C%22PUBLIC_SETTINGS%22%3A%7B%7D%2C%22ROOT_URL%22%3A%22http%3A%2F%2Flocalhost%3A3000%2F%22%2C%22ROOT_URL_PATH_PREFIX%22%3A%22%22%2C%22appId%22%3A%22150zjr3301zki1vu3if5%22%2C%22autoupdateVersion%22%3A%22f99492306a9c2e8b74ec8d57b6be22b8eb19f240%22%2C%22autoupdateVersionRefreshable%22%3A%22e86b152ee079afa62b62b6d5106ea59d50331e9d%22%2C%22autoupdateVersionCordova%22%3A%22none%22%7D"));</script>
      <script type="text/javascript" src="/DTube_files/3089e162729c36636c7293991f86a4bdeb4587a3.js?v=08192017b">
 </script>
      <script type="text/javascript">Meteor.disconnect();</script>

    </body></html>

重现问题的代码:

public static void main(String[] args) throws InterruptedException {

    JBrowserDriver driver = new JBrowserDriver(Settings.builder()
            .ajaxResourceTimeout(10000)
            .ajaxWait(10000)
            //.blockAds(true)
            //.headless(true)
            //.ignoreDialogs(true)
            .requestHeaders(RequestHeaders.CHROME)
           .ssl("trustanything")
           // .timezone(Timezone.PACIFIC_AUCKLAND)
            .userAgent(UserAgent.CHROME)
            .build());

    driver.get("https://dtube.video/login");
    System.out.println(driver.getPageSource());
    WebElement email = driver.findElementByName("username");
driver.quit();
}

0 个答案:

没有答案