2

i have been getting a lot of help from you guys and i am really glad. have passed these huddles,

web page source downloaded through Jsoup is not equal to the actual web page source

How to download a Web page source using Selenium

and now i am finally here for the last huddle (hopefully)

while running the selenium test case, like this,

 WebDriver driver = new FirefoxDriver();
        FluentWebDriver fwd = new FluentWebDriver(driver);

        driver.manage().timeouts().implicitlyWait(5L, TimeUnit.SECONDS);
        driver.get("http://www.justdial.com/Bangalore/Tape-Dealers-%3Cnear%3E-Bangalore-City-Railway-Station/ct-12976/page-5");

       String res = driver.getPageSource();

it opens up the web browser and starts downloading all the images that are there in the page and caues a delay for the source code to be downloaded from my java program. how can i avoid opening up my browser in this scenario?? i just want the page source and NO graphical content. and hence avoid the delay too... please help!! thanks in advance!!

Community
  • 1
  • 1
Vasanth Nag K V
  • 4,860
  • 5
  • 24
  • 48

1 Answers1

1

I haven´t used FluentWebDriver but I guess you could try replacing the FirefoxDriver with the HtmlUnitDriver:

Replace:

WebDriver driver = new FirefoxDriver();

With:

HtmlUnitDriver driver = new HtmlUnitDriver();

djonsson
  • 603
  • 5
  • 14