forked from TalhaBinAshraf1/SeleniumTestingInternetHerokuApp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDynamicLoading.java
More file actions
28 lines (23 loc) · 993 Bytes
/
Copy pathDynamicLoading.java
File metadata and controls
28 lines (23 loc) · 993 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package allTests;
import org.testng.annotations.Test;
import utility.BaseTest;
import utility.FrameworkConstants;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class DynamicLoading extends BaseTest{
@Test
public void test() throws InterruptedException {
System.setProperty(FrameworkConstants.CHROME_DRIVER_KEY,FrameworkConstants.CHROME_DRIVER_PATH);
WebDriver driver = new ChromeDriver();
driver.findElement(By.xpath("//a[contains(text(),'Dynamic Content')]")).click();
//To get direct descendants with 'row' class of div elements
List<WebElement> dynamicContent = driver.findElements(By.cssSelector("div#content>div.row"));
//To get the text from the 2nd row of dynamic content
System.out.println(dynamicContent.get(1).findElement(By.cssSelector("div:nth-child(2)")).getText());
Thread.sleep(6000);
driver.quit();
}
}