2017-02-28 13 views
0

相対パスでjarファイルを作成しましたが(リソース内にgeckodriverを指定してマップしたことを意味します)、Firefoxは起動しますが、URLはロードされません。複数のオペレーティングシステムを実行している複数のシステムで実行する必要があります。誰も助けることができますか?あなたが低いバージョンをgeckodriver使用しているときに発生しURLがFirefox(Selenium)にロードされていません

import com.relevantcodes.extentreports.ExtentReports; 
import com.relevantcodes.extentreports.ExtentTest; 
import com.relevantcodes.extentreports.LogStatus; 
import org.junit.Test; 
import org.openqa.selenium.firefox.FirefoxDriver; 
import org.openqa.selenium.firefox.FirefoxProfile; 
import org.testng.annotations.BeforeTest; 

import java.text.DateFormat; 
import java.text.SimpleDateFormat; 
import java.util.Date; 
import java.util.List; 


public class Maintest { 

    public static FirefoxDriver driver; 
    //public static ChromeDriver driver; 
    public static String downloadPath = "/home/user/Desktop/Downloads"; 
    private static ExtentReports reports; 


    @BeforeTest 

    public static void createDriver() { 
     System.setProperty("webdriver.firefox.marionette", "/home/user/Desktop/geckodriver"); 
     driver = new FirefoxDriver(FirefoxDriverProfile()); 
     driver.manage().window().maximize(); 
    } 

    public static FirefoxProfile FirefoxDriverProfile() { 
     FirefoxProfile profile = new FirefoxProfile(); 
     profile.setPreference("browser.download.folderList", 2); 
     profile.setPreference("browser.download.manager.showWhenStarting", false); 
     profile.setPreference("browser.download.dir", downloadPath); 
     profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/octet-stream"); 
     profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "text/csv, application/pdf,application/octet-stream"); 
     profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/pdf,application/x-pdf, application/pdf,application/vnd.fdf,application/vnd.ppdf, application/acrobat, applications/vnd.pdf, text/pdf, text/x-pdf, application/vnd.cups-pdf, application/foxit"); 
     profile.setPreference("browser.helperApps.neverAsk.openFile", 
       "text/csv,application/x-msexcel,application/excel,application/x-excel,application/vnd.ms-excel,image/png,image/jpeg,text/html,text/plain,application/msword,application/xml/application/pdf"); 
     profile.setPreference("browser.helperApps.neverAsk.saveToDisk", 
       "text/csv,application/x-msexcel,application/excel,application/x-excel,application/vnd.ms-excel,image/png,image/jpeg,text/html,text/plain,application/msword,application/xml/application/pdf"); 
     profile.setPreference("browser.helperApps.alwaysAsk.force", false); 
     profile.setPreference("pdfjs.disabled", true); 
     profile.setPreference("plugin.scan.Acrobat", "99.0"); 
     profile.setPreference("plugin.scan.plid.all", false); 
     profile.setPreference("plugin.disable_full_page_plugin_for_types", "application/pdf"); 
     profile.setPreference("browser.download.manager.alertOnEXEOpen", false); 
     profile.setPreference("browser.download.manager.focusWhenStarting", false); 
     profile.setPreference("browser.download.manager.useWindow", false); 
     profile.setPreference("browser.download.manager.showAlertOnComplete", false); 
     profile.setPreference("browser.download.manager.closeWhenDone", false); 
     return profile; 
    } 

    @Test 

    public static void bridge(List<String> selectedList) throws Exception { 
     createDriver(); 
     System.out.println("###############"+new Date()+"###############\n\n"); 
     DateFormat format = new SimpleDateFormat("dd-MM-yyyy"); 
     Date date = new Date(); 
     String dateTime = format.format(date); 
     reports = new ExtentReports("/home/user/Desktop/Regression Results-"+dateTime+".html", true); 
     driver.get("http://sitename"); 
+0

から最新のバージョンをダウンロードできますか他のブラウザでも動作しますか? – balazs630

+0

nope。どのブラウザにもURLがロードされない –

+0

上記のコードをご覧ください。それは、私がスクリプトを開発したマシンでは動作しますが、Firefox 49以上のマシンでは動作しません。 jarファイルを使用して実行します。 –

答えて

0

既知の問題、ヤモリドライバのバージョンを確認する追加するもう一つは、あなたの与えられた環境と互換性かではありません。 https://github.com/mozilla/geckodriver/releases

+0

最新のものを使用しています。 –

+0

あなたの環境についての詳細をお知らせください。 – Abhishek

+0

intellij 16.3、gecko v0.14.0。 FF48版まで走らせることができます。セレンとjavaを使用して自動化されたサイト全体。 FF 49,50,51は機能しません。私は別のOSとFirefoxのバージョンを実行している別のマシンで実行する必要があります。 –

関連する問題