1
Junit Testの場合、ブラウザを開き、自分のサイトに移動し、フィールドに電子メールを入力しようとしています。すべての私のコマンドが正しいですが、それは、特にCSSクラスで要素を見つけるために、適切な構文すなわちdriver.findElement(By.cssSelector)私のJunitテストケースでdriver.findElement(By.cssSelector)が実行されていない
package JUnitTesting;
import static org.junit.Assert.*;
import java.util.concurrent.TimeUnit;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
//import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class BasicActions {
WebDriver driver;
String BaseUrl;
@Before
public void setUp() throws Exception {
//System.setProperty("webdriver.chrome.driver", "C:\\Automation\\chromedriver_win32\\chromedriver.exe");
driver = new FirefoxDriver();
BaseUrl = "https://www.flock.co/in/indexd/";
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
}
@Test
public void test() {
driver.get(BaseUrl);
System.out.println("opening the base url");
driver.findElement(By.xpath("//div[@id='main-area']//input[@type='email']")).clear();
driver.findElement(By.cssSelector("._g-s-input>input")).sendKeys("[email protected]");
System.out.println("Entering a valid email id");
driver.findElement(By.xpath("//div[@id='main-area']/div[2]/div[2]//button[@class ='_g-s-button']")).click();
System.out.println("Redirecting to web.flock.co");
}
@After
public void tearDown() throws Exception {
driver.quit();
}
}
エラーは何ですか? – Grasshopper
新しいFirefox> 47では、geckodriverを取得する必要があります。 https://github.com/mozilla/geckodriver/releasesでドライバをダウンロードできます。 'System.setProperty(" webdriver.gecko.driver "、" Path to geckodriver executable ");' –
@adeealamsz私は既にパスに指定しています。それでも私はこのエラーを表示します –