Forum Discussion
Thanks Jake. Your post was quite timely with my intentions to try Selenium with LogicMonitor and very much helped get me started (although I used CentOS collector machine, but still the bash-script gave the right direction of course! ?
Those DataSources seemed to be private, so I could not load them, so I created one myself (included below; possibly very bad version, but it works ? ).
In order to check textFields in the target web site, I also added two more libraries in addition to the selenium-server-standalone.jar:
wrapper.java.classpath.115=../custom/selenium-server-standalone.jar
wrapper.java.classpath.116=../custom/hamcrest-2.2.jar
wrapper.java.classpath.117=../custom/junit-4.13.jar
And here is my example Groovy-script just to help others (maybe):
import com.santaba.agent.groovyapi.expect.Expect;
import com.santaba.agent.groovyapi.snmp.Snmp;
import com.santaba.agent.groovyapi.http.*;
import com.santaba.agent.groovyapi.jmx.*;
import org.xbill.DNS.*;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.core.IsNot.not;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
//import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Alert;
import org.openqa.selenium.Keys;
import java.util.*;
import java.net.MalformedURLException;
import java.net.URL;
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--no-sandbox");
//chromeOptions.addArguments("--remote-debugging-port=9222");
//chromeOptions.addArguments("--disable-dev-shm-usage");
//chromeOptions.addArguments("--disable-gpu");
chromeOptions.addArguments("--headless");
WebDriver driver = new ChromeDriver(options=chromeOptions);
driver.get("http://juhani.exdecfinland.org/~tforsell/home.html");
// driver.manage().window().setSize(new Dimension(1321, 916));
driver.findElement(By.cssSelector("a:nth-child(4) > img")).click();
assertThat(driver.findElement(By.cssSelector("h2:nth-child(56)")).getText(), is("Saksan reissu -Germany trip 2005"));
driver.close();
driver.quit();
println("TeijoScriptStatus=Success");
Related Content
- 25 days ago
- 2 years ago
- 2 years ago