Skip to content

Examples

Sushil Kumar Gupta edited this page Aug 22, 2020 · 3 revisions

HTML source code

Image

Example for the implicit and explicit wait methods:

import java.util.List;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import io.github.sukgu.Shadow;

public class ShadowTest {

	public static void main(String[] args) {
		WebDriver driver = new ChromeDriver();
		Shadow shadow = null; 
		driver.navigate().to("https://www.virustotal.com/gui/home/upload");
		shadow = new Shadow(driver);
		try {
			//if you want to use implicit wait
			shadow.setImplicitWait(10); //will wait for 10 secs.
			shadow.setExplicitWait(10,5); //will wait for maximum 10 secs and will check after every 5 secs.
		} catch (Exception e) {
			e.printStackTrace();
		}
		WebElement element = shadow.findElement("home-view#home-view>vt-ui-button[data-route='url']");
		System.out.println(element.getText());
		
		List<WebElement> ele = shadow.findElements("home-view#home-view>vt-ui-button[data-route='url']");
		System.out.println(ele);
	}
}
Clone this wiki locally