Webdriver를 처음 사용했습니다. 파이어 폭스 브라우저에서 프록시 설정을 사용하여 애플리케이션에 대한 데이터 테스트를 구현했다. 어떻게 든 내 브라우저는 실행하는 동안 두 번 실행됩니다. 사람이 무엇이 잘못되었는지에 좀 도와 주실 래요 여기WebDriver/TestNG : 브라우저를 두 번 실행하십시오.
내 코드입니다 : 도움을
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.Proxy.ProxyType;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.AfterTest;
import jxl.*;
import jxl.read.biff.BiffException;
public class Datadriven_login {
public static WebDriver ff = new FirefoxDriver();
@Test
public void f() throws BiffException, IOException, Throwable {
FileInputStream file = new FileInputStream ("C:\\Users\\user\\Desktop\\Datadriven.xls");
Workbook w = Workbook.getWorkbook(file);
Sheet s = w.getSheet(0);
for(int rows =1 ; rows <= s.getRows(); rows++)
{
FirefoxProfile ffp = new FirefoxProfile();
ffp.setPreference("network.proxy.type", ProxyType.AUTODETECT.ordinal());
ff = new FirefoxDriver(ffp);
ff.get("https://xyz.do");
String username = s.getCell(0, rows).getContents();
ff.findElement(By.xpath("//*[@id='TableMain']/tbody/tr/td/form/table/tbody/tr[4]/td/table/tbody/tr/td/table/tbody/tr[1]/td[2]/input")).sendKeys(username);
String password = s.getCell(1, rows).getContents();
System.out.println(rows + "-" + "-" + username + "/"+ password);
ff.findElement(By.xpath("//*[@id='TableMain']/tbody/tr/td/form/table/tbody/tr[4]/td/table/tbody/tr/td/table/tbody/tr[2]/td[2]/input")).sendKeys(password);
감사합니다!