Solution:-
driver.get("http://qaagility.com/");
driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
driver.findElement(By.xpath(".//*[@id='main_header']/nav/ul/li[5]/a")).click();
WebElement elements = driver.findElement(By.xpath("//div[@class='contact_container'][1]/div[@class='contact_us'][2]/div[@class='address']"));
JavascriptExecutor js = (JavascriptExecutor) driver;
int yScrollPosition = elements.getLocation().getY();
js.executeScript("window.scroll(0, " + yScrollPosition + ");");
String address = elements.getText();
System.out.println(address);
Use below XPath:-
//div[@class='contact_container']//div[@class='address']
Use below code:-
String address = driver.findElement(By.xpath("//div[@class='contact_container']//div[@class='address']")).getText();
System.out.println(address);
If still not work then there should be a frame present on your DOM
You need to switch to frame first.
refer my answer in below:-
Selenium in C# - How do I navigate different frames
change the syntax because answer is in C# and probably you need a java code
Hope it will help you :)