You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.
I Have written the code for the gmail login to valid 10 login creditanals,When im running the code getting the problem as below given.PLease verify the code as well as problem and give the solution.
#7761
package SeleniumtestNG;
import java.io.FileInputStream;
import jxl.Sheet;
import jxl.Workbook;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.AfterTest;
import com.thoughtworks.selenium.Selenium;
public class GmailLogin {
public WebDriver driver;
public Selenium selenium;
@Test
public void Verifygmaillogin() throws Exception{
FileInputStream fi=new FileInputStream("D:\\Workspace_Latest\\Automation\\Testdata\\Logingmail.xls");
Workbook w=Workbook.getWorkbook(fi);
Sheet s=w.getSheet("gmail");
for (int i = 1; i < s.getRows(); i++) {
driver.findElement(By.id("Email")).sendKeys(s.getCell(0,i).getContents());
driver.findElement(By.id("Passwd")).sendKeys(s.getCell(1,i).getContents());
driver.findElement(By.id("signIn")).click();Thread.sleep(6000);
if (selenium.isElementPresent(".//*[@id='gb']/div[1]/div[1]/div[2]/div[5]/div[1]/a/span"))
{
driver.findElement(By.xpath(".//*[@id='gb']/div[1]/div[1]/div[2]/div[5/div[1]/a/span")).click();
}
if (selenium.isElementPresent("Sign out")) { driver.findElement(By.linkText("Sign out")).click();
if(selenium.isElementPresent("Sign in with a different account")){
driver.findElement(By.linkText("Sign in with a different account")).click();
}
} else {
System.out.println("Invalid Creditnals");
}
}
}
@BeforeTest
public void beforeTest() {
driver=new FirefoxDriver();
driver.get("http://gmail.com");
driver.manage().window().maximize();
}
@AfterTest
public void afterTest() {
}
}
--------------
[TestNG] Running:
C:\Users\chandra\AppData\Local\Temp\testng-eclipse--1306388759\testng-customsuite.xml
FAILED: Verifygmaillogin
java.lang.NullPointerException
at SeleniumtestNG.GmailLogin.Verifygmaillogin(GmailLogin.java:29)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
===============================================
Default test
Tests run: 1, Failures: 1, Skips: 0
===============================================
===============================================
Default suite
Total tests run: 1, Failures: 1, Skips: 0
===============================================
[TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@1beea90: 129 ms
[TestNG] Time taken by org.testng.reporters.XMLReporter@402e11: 17 ms
[TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 14 ms
[TestNG] Time taken by org.testng.reporters.jq.Main@d75cf7: 61 ms
[TestNG] Time taken by org.testng.reporters.JUnitReportReporter@17035c6: 12 ms
[TestNG] Time taken by org.testng.reporters.EmailableReporter2@1189cbb: 12 ms
Reported by suryash143 on 2014-08-16 17:54:47
The text was updated successfully, but these errors were encountered:
Originally reported on Google Code with ID 7761
Reported by
suryash143
on 2014-08-16 17:54:47The text was updated successfully, but these errors were encountered: