Skip to content

Instantly share code, notes, and snippets.

@tillsc
Last active September 28, 2015 14:39
Show Gist options
  • Save tillsc/90e975a0b95ae18d3242 to your computer and use it in GitHub Desktop.
Save tillsc/90e975a0b95ae18d3242 to your computer and use it in GitHub Desktop.
galen setup script tying to fix `clientWidth` in Browsers showing a vertical scrollbar
function setup() {
// create driver and other stuff
// ...
driver.get(url);
var realWidth = inject(driver, 'return document.documentElement.clientWidth');
if (realWidth < size.width) {
var w = 2 * size.width - realWidth;
console.log("clientWidth is " + realWidth + ". Correcting width to: " + w);
com.galenframework.utils.GalenUtils.resizeDriver(driver, "" + w + "x" + size.height);
console.log("fixed clientWidth: " + inject(driver, 'return document.documentElement.clientWidth'));
}
return driver;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment