2015-06-06 57 views
-1

正如我的webdriver腳本在中運行良好Chrome,Firefox,Opera,Safari。但是,當我在IE11中運行這個腳本時,它只能在這之後打開網頁,它不能執行任何其他功能。Webdriver腳本在所有其他瀏覽器中工作正常,但不能在IE11中工作

請幫助我,告訴我它有什麼問題。我正在使用IE11 webdriver64位。我已經在環境變量中設置了它的路徑。

因爲我是新手。這就是爲什麼我試着用這個簡單的代碼。

我的腳本:

package facebook; 

import java.util.concurrent.TimeUnit; 

import org.openqa.selenium.By; 

import org.openqa.selenium.WebDriver; 

import org.openqa.selenium.chrome.ChromeDriver; 

import org.openqa.selenium.firefox.FirefoxDriver; 

import org.openqa.selenium.ie.InternetExplorerDriver; 

import org.openqa.selenium.safari.SafariDriver; 

import org.openqa.selenium.support.ui.ExpectedConditions; 

import org.openqa.selenium.support.ui.WebDriverWait; 

public class Pratice { 

    public static WebDriver driver = null; 
    public static void main(String[] args) throws Exception 
    { 
     //driver = new FirefoxDriver(); 
     //driver = new ChromeDriver(); 
     //driver = new InternetExplorerDriver(); 
     driver = new SafariDriver(); 
     driver.manage().window().maximize(); 
     driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); 
     driver.get("http://www.facebook.com/"); 
     //WebDriverWait wait1 = new WebDriverWait(driver, 10); 
     //wait1.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//a[contains(text(),'Create a Page')]"))); 
     driver.findElement(By.xpath("//input[@id='u_0_n']")).click(); 
     WebDriverWait wait = new WebDriverWait(driver, 10); 
     wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//a[contains(text(),'Sign up for Facebook')]"))); 
     String a = driver.getTitle(); 
     System.out.println(a); 
     Thread.sleep(5000); 
     driver.close(); 
    } 

} 
+0

什麼是錯誤? – Saifur

+0

它沒有給出任何類型的錯誤....當我運行這個腳本比IE網頁像www.facebook.com打開....但之後,它不能執行任何功能,如點擊提交按鈕或發送使用sendKeys在文本字段上的字符。 – adityashivankar

+0

hello sir ....下面的鏈接適用於我...感謝您的回覆 – adityashivankar

回答

0

同樣的事情發生在我身邊,我設置一個註冊表項,請參閱here

+0

當我運行腳本時,出現錯誤org.openqa.selenium.ElementNotVisibleException:無法單擊元素(警告:服務器沒有提供任何堆棧跟蹤信息)。我做了以下改變,IE成功運行:driver.findElement(By.xpath(「// input [@ id ='u_0_l']」))。click(); – Aru

+0

謝謝你這麼多先生.....這是行得通的.....現在我也可以運行我的項目腳本....意思就像上面你提供了一個鏈接的幫助,我能夠運行我的腳本。 – adityashivankar

相關問題