good morning
I am trying to do the integration of Neoload with Selenium, I have seen in its documentation and videos that do it with firefox browser. I want to know if it is possible to use chrome browser, in integration and execution?
i found this
package com.selenium.test;
import static com.neotys.selenium.proxies.NLWebDriverFactory.addProxyCapabilitiesIfNecessary;
import java.io.File;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import com.neotys.selenium.proxies.NLWebDriver;
import com.neotys.selenium.proxies.NLWebDriverFactory;
public class UnitTest {
private static final String CHROME_DRIVER_PATH = "C:\\Selenium\\chromedriver.exe";
static {
final File file = new File(CHROME_DRIVER_PATH);
System.setProperty("webdriver.chrome.driver", file.getAbsolutePath());
}
static NLWebDriver driver;
@BeforeClass
public static void before() {
final ChromeDriver webDriver = new ChromeDriver(addProxyCapabilitiesIfNecessary(new DesiredCapabilities()));
// projectPath used to open NeoLoad project, null to use currently opened Project.
final String projectPath = "C:\\Users\\anouvel\\Documents\\NeoLoad Projects\\v5.3\\Sample_Project\\Sample_Project.nlp";
driver = NLWebDriverFactory.newNLWebDriver(webDriver, "SeleniumUserPath", projectPath);
}
@Test
public void testSubmit() {
driver.startTransaction("home1");
driver.get("http://ushahidi.demo.neotys.com/");
driver.startTransaction("reports");
driver.findElement(By.id("mainmenu")).findElements(By.tagName("a")).get(1).click();
driver.startTransaction("submit");
driver.findElement(By.partialLinkText("SUBMIT")).click();
}
@Test
public void testGetAlerts() {
driver.startTransaction("home2");
driver.get("http://ushahidi.demo.neotys.com/");
driver.startTransaction("alerts");
driver.findElement(By.partialLinkText("GET ALERTS")).click();
}
@AfterClass
public static void after() {
if (driver != null) {
driver.quit();
}
}
}
Hi Mario, the NeoLoad driver is a wrapper around the driver of your choice so that you can use the browser that you prefer.
christophe answered
Mario answered
Mario posted a new question