简体   繁体   中英

How to run the selenium in default browser of firefox

I have tried the FirefoxProfile , but I received the exception -

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space.

Using following code -

ProfilesIni prf=new ProfilesIni();
FirefoxProfile profile=prf.getProfile("default-1453281235998");
WebDriver driver=new FirefoxDriver(profile);
driver.get("http://192.168.5.14/ames_1.3.0/login");
driver.findElement(By.id("txtUser")).sendKeys("XXX");
driver.findElement(By.id("txtPass")).sendKeys("XXX");
driver.findElement(By.xpath("//input[@value='LOGIN']")).click();
try{
        driver.findElement(By.id("act2")).click();
    }
 catch(NoSuchElementException ex)
 {
 }
driver.findElement(By.id("adminBannerLink_id")).click();
driver.findElement(By.id("BGMLink_id")).click();
driver.findElement(By.id("BSGMLink_id")).click();

java.lang.OutOfMemoryError: Java heap space. means your heap space maybe too small. try use java -Xms128m -Xmx1024m -jar selenium.jar.

JAVA OPTS see: http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM