package test;
import java.util.ArrayList;
import java.util.List;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import com.memetix.mst.language.Language;
import com.memetix.mst.translate.Translate;
public class my {
static WebDriver driver =new FirefoxDriver();
public static void GoogleSearch() throws Exception {
driver.get("http://www.google.co.in");
driver.manage().window().maximize();
String execScript = "return document.documentElement.scrollHeight>document.documentElement.clientHeight;";
JavascriptExecutor scrollBarPresent = (JavascriptExecutor) driver;
Boolean test = (Boolean) (scrollBarPresent.executeScript(execScript));
if (test == true) {
System.out.print("Scrollbar is present.");
} else if (test == false){
System.out.print("Scrollbar is not present.");
}
}
public static void main(String[] args) {
try {
GoogleSearch();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
import java.util.ArrayList;
import java.util.List;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import com.memetix.mst.language.Language;
import com.memetix.mst.translate.Translate;
public class my {
static WebDriver driver =new FirefoxDriver();
public static void GoogleSearch() throws Exception {
driver.get("http://www.google.co.in");
driver.manage().window().maximize();
String execScript = "return document.documentElement.scrollHeight>document.documentElement.clientHeight;";
JavascriptExecutor scrollBarPresent = (JavascriptExecutor) driver;
Boolean test = (Boolean) (scrollBarPresent.executeScript(execScript));
if (test == true) {
System.out.print("Scrollbar is present.");
} else if (test == false){
System.out.print("Scrollbar is not present.");
}
}
public static void main(String[] args) {
try {
GoogleSearch();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Explanation
I will make it easier:
scrollHeight
clientHeight + non-visible height
Height of all content + paddings, despite of element height:
clientHeight
visible height of content + visible padding
Visible height: content portion limited by explicitly defined element height
offsetHeight
clientHeight + border + scrollbar
Height occupied by the element on document.
No comments:
Post a Comment