selenium-webdriverをインストールしました。 IE componentをダウンロードして(Windows 8を使用して)自分のパスに入れてください。Webドライバの例が動作しません
IEを開き、すべてのセキュリティゾーンを高く設定しますが、同じである必要がありますが、「制限付きサイト」ではanytingに設定することができないため、他のすべてを高く変更する必要があります。その後
\ node_modules \セレンwebdriverをの修正版を走った\例\ google_search.js:
var webdriver = require('..'),
By = webdriver.By,
until = webdriver.until;
var driver = new webdriver.Builder()
.forBrowser('ie')
.build();
driver.get('https://www.google.com/?gws_rd=ssl');//no redirect
driver.findElement(By.name('q')).sendKeys('webdriver');
driver.findElement(By.name('btnG')).click();
driver.wait(until.titleIs('webdriver - Google Search'), 1000);
driver.quit();
IEが起動し、Googleを開き、私は次のエラーを取得する:
NoSuchElementError: Unable to find element with css selector == *[name="q"]
私は要素が「ソースの表示」以来のページにあるかなり確信している私に
<input class="lst lst-tbb sbibps" id="lst-ib" maxlength="2048" name="q"
を与えますdocument.body.querySelector("*[name=\"q\"]")
はgoogle.comでIE 11で定義されていないので、実際にIEで問題になる可能性がありますが、これはIEでセレンを使用することができないことを意味します。
[UPDATE]
デフォルト設定に戻ってセキュリティレベルを変更する場合は、クエリセレクタ作品が、その後のセレンのクラッシュ:
WebDriverError: Unexpected error launching Internet Explorer. Protected Mode set tings are not the same for all zones. Enable Protected Mode must be set to the s ame value (enabled or disabled) for all zones.
あなたの返事をありがとう、それは高いセキュリティ設定JavaScriptを破るが、この答えによると思われる:http://stackoverflow.com/a/14957443/1641941すべてのセキュリティ設定は同じでなければならないし、私はできません"Restricted Sites"を何かに変更してください。私はこの問題を解決する方法がわかりません。 – HMR
うーん...すごく助けてくれて申し訳ありません!他に何が見つかるか試してみる。あきらめてはいけない :) – deeveeABC