2016-04-11 16 views
-4

aşağıdaki kombinasyonu ile yardıma ihtiyacım düzgün çalışmıyor, OS: Windows 10 kullanılan Tarayıcı: Firefox 45.0.1 Java sürümü: Java 8 güncelleştirmesi 51 (64 bit) Selenyum: kütüphane 2.47.1 Bizim kodumuz basit.Selenyum + Java + Firefox + Windows

import org.apache.logging.log4j.Logger; 
import org.apache.logging.log4j.LogManager; 
import org.testng.annotations.Test; 
import org.testng.annotations.BeforeMethod; 
import org.testng.annotations.AfterMethod; 
import org.testng.annotations.BeforeClass; 
import org.testng.annotations.AfterClass; 

import java.util.List; 
import java.util.concurrent.TimeUnit; 

import org.testng.Assert; 

import org.openqa.selenium.By; 
import org.openqa.selenium.WebDriver; 
import org.openqa.selenium.WebElement; 
import org.openqa.selenium.firefox.FirefoxDriver; 
//import org.openqa.selenium.support.ui.ExpectedConditions; 
import org.openqa.selenium.support.ui.WebDriverWait; 

public class TestClass01 
{ 
    static final Logger logger1 =  LogManager.getLogger(TestClass01.class.getName()); 

    WebDriver driver ; 
    String baseUrl ; 
    static int testCount = 0 ; 
    String[] content_heading ; 
    List<WebElement> temp_list ; 
    WebDriverWait wait; 
    boolean exists; 

    @BeforeClass 
    public void beforeClass() 
    { 
     logger1.entry(); 
     logger1.info("Entering the class : " + this.getClass().getSimpleName()); 

     driver = new FirefoxDriver(); 
     baseUrl = "http://www.google.com"; 

     logger1.info("Maximizing the browser window and setting up the implicit timeout for element/page loading...."); 
     driver.manage().window().maximize(); 
     //Specifies the amount of time the driver should wait when searching for an element 
     driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS); 

     logger1.info("Fetching the Homepage for Jacuzzi"); 

     // launch Firefox and direct it to the Base URL 
     driver.get(baseUrl+"/"); 


    } 
} 

Ancak

org.openqa.selenium.firefox.NotConnectedException, hatayı aşağıdaki atar: 45000 ms sonra port 7055 tarihinde 127.0.0.1 barındırmak için bağlanılamıyor. Firefox konsol çıkışı: DEBUG için XPIState güncellemesi {"id": "{972ce4c6-7e08-4474-a285-3208198ce6fd}", "syncGUID": "BbZlO30v46U7", "location": "app-global", "version" : "45.0.1", "type": "tema", "InternalName": "klasik/1.0", "updateURL": null, "updateKey": null, "optionsURL": null, "optionsType": null," aboutURL ": null," simgeler ": {" 32 "" icon.png " "48", "icon.png"} "iconURL":, boş "icon64URL": null, "defaultLocale": {" adı ":" Varsayılan "," açıklama ":" varsayılan teması. "," Yaratici ":" Mozilla "," homepageURL ": null," katkıda bulunanlar ": [" Mozilla Katkıda Bulunanlar "]}," görünür ": true, "active": true "userDisabled": false, "appDisabled": false, "descriptor": "C: \ Program Dosyalar (x86) \ Mozilla Firefox \ tarayıcı \ extensions \ {972ce4c6-7e08-4474- a285-3208198ce6fd} .xpi " "InstallDate": 1458533973089, "updateDate": 1458533973089," applyBackgro undUpdates ": 1," kaplanabilir ": true," boyut ": 22012," sourceURI ": null" releaseNotesURI ": null," softDisabled ": false" foreignInstall ": false," hasBinaryComponents ": false," strictCompatibility" : doğru, "yerel ayarlar": [], "targetApplications": [{ "id" "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}", "minVersion": "45.0.1", "maxVersion": "45.0 .1 "}]," targetPlatforms ": []," seen ": true}

+0

"çoğunlukla online" - çok yararlı gerçekten. –

+0

ff'yi düşürmeyi deneyin – Sighil

cevap

2

Bu, Firefox tarayıcısının en son tarayıcısındaki yeni sorun nedeniyle gerçekleşiyordu.

Selenyum kavanozlarınızı güncelleyin. Firefox'un yeni sürümü (Veya farklı bir tarayıcı), selenyumun eski kavanozlarını desteklemiyor. Selenyum Müşteri & WebDriver dili ile bağlanma

kullandığınız eski kavanoz yerine onları

İndir hem Selenyum Sunucusu (eski Selenyum RC Sunucusu). Güncellenmiş sonuçlar

kaynağını alabilirsiniz da mozilla güncelle: - http://docs.seleniumhq.org/download/

bu sorundan aşmak için ayrıca firefox Profil xpinstall.signatures.required", false olarak setPreference gerekir ve daha sonra sürücü nesnesine geçmek

firefoxProfile.setPreference("xpinstall.signatures.required", false); 

Aşağıdaki kod benim için iyi çalışıyor.

static WebDriver driver=null; 
public static void main(String[] args) { 
final FirefoxProfile firefoxProfile = new FirefoxProfile(); 
firefoxProfile.setPreference("xpinstall.signatures.required", false); 
driver = new FirefoxDriver(firefoxProfile); 
driver.get("https://www.google.de/"); 

o size yardımcı olacaktır Umut :)

+0

Çok teşekkürler. Tavsiyeni izledikten sonra düzgün çalışıyor. –