This is a sample that follows the link in Selenium. I wrote the following program in Java. Follow the link with Selenium (Python)
follow_link.java
// -----------------------------------------------------------------------
/*
follow_link.java
Sep/21/2018
*/
// -----------------------------------------------------------------------
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.By;
public class follow_link {
// -----------------------------------------------------------------------
public static void main(String[] args) {
System.err.println ("***start***");
String url = "https://ekzemplaro.org";
WebDriver driver = new FirefoxDriver();
driver.get(url);
WebElement tag = driver.findElement(By.id("ekzemplaro"));
tag.click();
tag = driver.findElement(By.linkText("English"));
tag.click();
System.err.println ("***End***");
}
// -----------------------------------------------------------------------
}
// -----------------------------------------------------------------------
Makefile
follow_link.class: follow_link.java
javac follow_link.java -cp ./client-combined-3.14.0.jar
clean:
rm -f follow_link.class
Execution method
export CLASSPATH=.:./client-combined-3.14.0.jar:./guava-26.0-jre.jar:./okhttp-3.11.0.jar:./okio-2.0.0.jar:./kotlin-stdlib-1.2.60.jar:./commons-exec-1.3.jar
#
java follow_link
Recommended Posts