Reputation: 801
Using Selenium WebDriver under .net, when PhantomJS starts up, the default viewportSize is 400 px wide by 300 px high. Is it possible to increase the default viewportSize using PhantomJSOptions before it is created?
Here is what I tried and it did not seem to have any effect:
PhantomJSOptions opts = new PhantomJSOptions();
opts.AddAdditionalCapability("phantomjs.page.viewportSize", "{ width: 1024, height: 768 }");
Here is an alternative that works after the driver is created:
driver.Manage().Window.Size = new System.Drawing.Size(1024,768);
Upvotes: 1
Views: 620
Reputation: 2829
Set the window size using WebDriver.
driver.set_window_size(1024,68)
If you really want to, perhaps this:
var phantomJSDriverService = PhantomJSDriverService.CreateDefaultService(phantomJsDir);
phantomJSDriverService.phantomjs.page.viewportSize = "{ width: 1024, height: 768 }";
var driver = new PhantomJSDriver(phantomJSDriverService);
Upvotes: 2