2016-05-10 4 views
0

私は、その内容をWebビューに読み込む電子アプリケーションを自動化しようとしています。私はそれのためにspectronとwebdriverioを使用しています。スペクトログラフを使用した電子ウェブビュー上の要素へのアクセス

ここに私が使用しているコードがあります。

it('should assess webview', function() { 
    var self = this; 
    return this.app.client.waitUntilWindowLoaded() 
     .windowHandles().then(function(session) { 
      self.app.client.switchTab(session.value[1]) 
      .click("#my-id") 
      .then(console.log.bind(console)) 
      .catch(console.log.bind(console)); 
     }); 
}); 

これは機能していないようです。私はどこが間違っているのか分からない。しかし私は

it('should assess webview', function() { 
    var self = this; 
    return this.app.client.waitUntilWindowLoaded() 
     .windowHandles().then(function(session) { 
      self.app.client.switchTab(session.value[1]) 
      .getSource() 
      .then(console.log.bind(console)) 
      .catch(console.log.bind(console)); 
     }); 
}); 

上記のコードを使用して、webviewウィンドウハンドルが正しいかどうかを確認しました。それはそうです。親切に助けてください。ありがとう

答えて

0

私はspectronを使用してこの動作をシミュレートするwebviewを使用してコードをチェックしています。コードは正常に動作します。コードを書き直しました。お役に立てれば。私はそれをチェックします@kamesh

it('should assess webview', function() { 
    var self = this; 
    return this.app.client.waitUntilWindowLoaded() 
     .windowHandles().then(function(session) { 
      // Need to return the promise back, if promise is 
      // it would wait for the state or else app will exit. 
      return self.app.client.switchTab(session.value[1]) 
      .click("#my-id") // check whether selector is present in DOM 
      .then(console.log.bind(console)) 
      .catch(console.log.bind(console)); 
     }); 
}); 

または

it('should assess webview', function() { 
    var self = this; 
    return this.app.client.waitUntilWindowLoaded() 
     .windowHandles() 
     .then(function(session) { 
      // switchTab & window will both focus 
      // window or tab which is active 
      return this.window(session.value[1]) 
     }) 
     .click("#my-id") // check whether selector is present in DOM 
     .then(console.log.bind(console)) 
     .catch(console.log.bind(console));; 
}); 
+0

感謝。 –

関連する問題