Java 硒:线程中的异常;“主要”;org.openqa.selenium.NoSuchSessionException:
我得到这个错误是因为像这样分开你的代码 并将驱动程序设置为@BeforeClass和Java 硒:线程中的异常;“主要”;org.openqa.selenium.NoSuchSessionException:,java,selenium,selenium-webdriver,geckodriver,Java,Selenium,Selenium Webdriver,Geckodriver,我得到这个错误是因为像这样分开你的代码 并将驱动程序设置为@BeforeClass和driver.quit()到@AfterClass 即使是虚构的,也不要在这里发布凭据。请指定您正在使用的selenium版本和geckodriver版本。同样,请指定firefox版本可能是我向上帝祈祷的副本,这不是您的真实FB id和password@RafałSokalski那是y,我说了祈祷,bcz这就是现在能做的一切:D package facebook; import org.openqa.sele
driver.quit()代码>到@AfterClass
即使是虚构的,也不要在这里发布凭据。请指定您正在使用的selenium版本和geckodriver版本。同样,请指定firefox版本可能是我向上帝祈祷的副本,这不是您的真实FB id和password@RafałSokalski那是y,我说了祈祷,bcz这就是现在能做的一切:D
package facebook;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class facebook {
public static void main(String[] args) {
System.setProperty("webdriver.gecko.driver","C:\\Users\\5558\\eclipse-workspace\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.get("https://www.facebook.com");
driver.manage().window().maximize();
driver.findElement(By.xpath(".//*[@id='email']")).sendKeys("abcdefg@gmail.com");
driver.findElement(By.xpath(".//*[@id='pass']")).sendKeys("selenium123");
driver.findElement(By.xpath(".//*[@id='u_0_2']")).click();
driver.quit();
}
}