I try to run an automation on notepad file on windows via winnap driver.
and I get : "FAILED CONFIGURATION: #BeforeMethod setUp
org.openqa.selenium.WebDriverException: Connection refused: no further
information"
What is can be ?
JAVA :
package com.mytest;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import io.appium.java_client.windows.WindowsDriver;
public class NotePadTest {
public static WindowsDriver driver = null ;
#BeforeMethod
public void setUp() {
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability("app","C:\\Windows\\System32\\notepad.exe");
cap.setCapability( "platform", "Windows");
cap.setCapability( "deviceName", "WindowsPC");
try {
driver = new WindowsDriver(new URL("http://127.0.0.1:4723"), cap);
} catch (MalformedURLException e) {
// TODO: handle exception
e.printStackTrace();
}
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
}
#AfterMethod
public void clenUp() {
driver.quit();
setUp();
}
#AfterSuite
public void tearDown() {
driver.quit();
}
#Test
public void checkHelpAboutNowTest() {
driver.findElementByName("App theme").click();
}
}
Related
Im writing a selenium project from scratch using the PageObject.
The below code is failing because the selenium webdriver is not finding elements on the webpage .
This is the error i get :
java.lang.NullPointerException: Cannot invoke "org.openqa.selenium.SearchContext.findElement(org.openqa.selenium.By)" because "this.searchContext" is null
DriverBase.java :
In this class i setup the driver
package com.EbankingA11y.base;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import com.EbankingA11y.util.WebListener;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
public class DriverBase {
protected static final Logger LOG = (Logger) LogManager.getLogger(WebListener.class);
public static WebDriver driver;
public static Properties prop;
public static FileInputStream fis;
public DriverBase() {
prop = new Properties();
try {
fis = new FileInputStream("C:\\Users\\config.properties");
} catch (FileNotFoundException exception) {
exception.printStackTrace();
LOG.debug(" Error \n " +exception.getStackTrace());
}
try {
prop.load(fis);
} catch (IOException exception) {
exception.printStackTrace();
LOG.debug(" Error \n " +exception.getStackTrace());
}
}
public static void initialization () throws InterruptedException {
System.setProperty("webdriver.chrome.driver", prop.getProperty("WEB_DRIVER_PATH") );
//WebDriverManager.chromedriver().setup();
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.setAcceptInsecureCerts(true);
driver = new ChromeDriver(chromeOptions);
driver.manage().window().maximize();
driver.get(prop.getProperty("URL"));
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
}
}
LoginPage.java
In this class i create all the element on the login page and all methods
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import com.EbankingA11y.base.DriverBase;
public class LoginPage extends DriverBase {
public LoginPage() {
PageFactory.initElements(DriverBase.driver, this);
}
#FindBy(name="username")
WebElement usernameTextBox;
#FindBy(name="password")
WebElement passwordTextBox;
#FindBy(xpath="//input[#value=\\\"Use 'Enter' to confirm\\\"]")
WebElement submitButton;
#FindBy(xpath="//button[#name='button']")
WebElement languageButton;
#FindBy(name="smsCode")
WebElement tokenTextBox;
public void performLogin () {
//WebDriverWait wait = new WebDriverWait(driver,30);
final String username = prop.getProperty("USERNAME");
final String password = prop.getProperty("PASSWORD");
System.out.println(username);
//wait.until(ExpectedConditions.visibilityOf(this.usernameTextBox));
usernameTextBox.clear();
passwordTextBox.clear();
usernameTextBox.sendKeys(username);
passwordTextBox.sendKeys(password);
submitButton.click();
//wait.until(ExpectedConditions.visibilityOf(this.tokenTextBox));
}
}
LoginPageTests.java :
In this class i write tests and i call methods from LoginPage.java Class
package com.EbankingA11y.testcases;
import java.io.IOException;
import org.openqa.selenium.WebDriver;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import com.EbankingA11y.base.*;
import com.EbankingA11y.pages.LoginPage;
public class LoginPageTest extends DriverBase {
public LoginPageTest() throws IOException {
super();
}
LoginPage loginPage = new LoginPage();
#BeforeTest
public void setup() throws InterruptedException {
initialization();
}
#Test
public void login() {
loginPage.performLogin();
}
}
I found that i have to declare the pages in the before methods after the initilisation ()
public class LoginPageTest extends DriverBase {
public LoginPageTest() throws IOException {
super();
}
// here
LoginPage loginPage;
TokenPage tokenPage;
#BeforeTest
public void setup() throws InterruptedException {
initialization();
//here
loginPage = new LoginPage();
tokenPage = new TokenPage();
}
#Test
public void login() {
tokenPage = loginPage.performLogin();
}
}
This is just worked for me
I first created a POM model framework for a test practice with LOG4J, listners for Screenshots.
Later tried to add Cucumber BDD framework also into the same framework. I'm able to run the tests as expected, but facing two issues:
POM Framework initial tests are able to take Screenshots, but BDD test fails with Null pointer exception, unable to get the driver object from the Methods.
Logs not getting printed for BDD tests while works fine with POM tests.
Code
TestRunner.java
package cucumberRunner;
import org.junit.runner.RunWith;
import io.cucumber.junit.Cucumber;
//import io.cucumber.junit.CucumberOptions;
import io.cucumber.testng.AbstractTestNGCucumberTests;
import io.cucumber.testng.CucumberOptions;
//#RunWith(Cucumber.class)
#CucumberOptions(
features="src/test/java/features",
glue="stepDefinitions")
public class TestRunner extends AbstractTestNGCucumberTests {
}
MyStepDefinitions.java
package stepDefinitions;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.junit.Assert;
import org.openqa.selenium.WebDriver;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import e2E4.UserLogins;
import pageObjects.LandingPage;
import pageObjects.LoggedOnPage;
import resources.BaseClass;
public class MyStepDefinitions extends BaseClass {
public WebDriver driver;
Logger log=LogManager.getLogger(UserLogins.class.getName());
#Given("^Initialize browser with Chrome$")
public void initialize_browser_with_Chrome() throws Throwable {
driver = driverIni();
}
#Given("^Navigate to \"([^\"]*)\" website$")
public void navigate_to_saucelabs_website(String arg1) throws Throwable {
driver.get(arg1);
}
#When("^User enters \"([^\"]*)\" and \"([^\"]*)\" and Logs in$")
public void user_enters_and_and_Logs_in(String arg1, String arg2) throws Throwable {
LandingPage lp=new LandingPage(driver);
lp.sendUsername().sendKeys(arg1);
lp.sendPassword().sendKeys(arg2);
lp.sendLoginBtn().click();
log.info("Logging in");
}
#Then("^Verify if user successfully logged in$")
public void verify_if_user_successfully_logged_in() throws Throwable {
LoggedOnPage lop=new LoggedOnPage(driver);
Assert.assertTrue(lop.filterbtn().isDisplayed());
log.info("Logged in successfully");
}
}
BaseClass.java
package resources;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.time.Duration;
import java.util.Properties;
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class BaseClass {
public WebDriver driver;
public Properties prop;
String dataPath=System.getProperty("user.dir");
public WebDriver driverIni() throws IOException {
FileInputStream fis=new FileInputStream(dataPath+"\\src\\main\\java\\resources\\data.properties");
prop=new Properties();
prop.load(fis);
String browserRequired=prop.getProperty("browser");
if(browserRequired.equalsIgnoreCase("chrome")) {
System.setProperty("webdriver.chrome.driver", dataPath+"\\chromedriver.exe");
driver=new ChromeDriver();
}
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
return driver;
}
public String screenshot(String methodName, WebDriver driver) throws IOException {
TakesScreenshot ts=(TakesScreenshot) driver;
File source=ts.getScreenshotAs(OutputType.FILE);
String dest=dataPath+"\\reports\\"+methodName+".png";
FileUtils.copyFile(source, new File(dest));
return dest;
}
}
Listners.java
package e2E4;
import java.io.IOException;
import org.openqa.selenium.WebDriver;
import org.testng.ITestContext;
import org.testng.ITestListener;
import org.testng.ITestResult;
import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.ExtentTest;
import com.aventstack.extentreports.Status;
import resources.BaseClass;
import resources.ExtendRep;
public class Listners extends BaseClass implements ITestListener {
WebDriver driver=null;
ExtendRep er=new ExtendRep();
ExtentReports extent=er.getReports();
ExtentTest test;
ThreadLocal<ExtentTest> et=new ThreadLocal<ExtentTest>();
public void onTestStart(ITestResult result) {
test=extent.createTest(result.getMethod().getMethodName());
et.set(test);
}
public void onTestSuccess(ITestResult result) {
String methodName=result.getMethod().getMethodName();
et.get().log(Status.PASS, "Test Passed Successfully");
try {
driver=(WebDriver)result.getTestClass().getRealClass().getDeclaredField("driver").get(result.getInstance());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
et.get().addScreenCaptureFromPath(screenshot(methodName,driver),result.getMethod().getMethodName());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void onTestFailure(ITestResult result) {
String methodName=result.getMethod().getMethodName();
et.get().fail(result.getThrowable());
try {
driver=(WebDriver)result.getTestClass().getRealClass().getDeclaredField("driver").get(result.getInstance());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
et.get().addScreenCaptureFromPath(screenshot(methodName,driver),result.getMethod().getMethodName());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void onTestSkipped(ITestResult result) {
}
public void onTestFailedButWithinSuccessPercentage(ITestResult result) {
}
public void onTestFailedWithTimeout(ITestResult result) {
}
public void onStart(ITestContext context) {
}
public void onFinish(ITestContext context) {
extent.flush();
}
}
P.S : ExtentReports were working fine tho throu the Listners. Not able to figure it out :(
My FireFox Version 49.0.1
Selenium Version: Selenium-java-3.0.0-beta3
Java: 8.0.1010.13
I have replaced all the existing Selenium Jar Files with the new files. Added the gecko.Driver to my code still I am seeing this message:
Error Message:
java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.gecko.driver system property;
My Code:
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.Keys;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class AbstractPage {
WebDriver Driver =new FirefoxDriver();
#Before
public void Homescreen() throws InterruptedException
{
System.getProperty("Webdriver.gecko.driver", "C:/geckodriver.exe");
System.setProperty("Webdriver.firefox.bin", "C:/Program Files (x86)/Mozilla Firefox/firefox.exe");
Driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
Driver.get("URL");
Driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
}
#After
public void TestComplete() {
Driver.close();
}
#Test
public void Projects() {
Driver.findElement(By.id("login-form-username")).sendKeys("Login");
Driver.findElement(By.id("login-form-password")).sendKeys("Password");
Driver.findElement(By.id("quickSearchInput")).sendKeys("ID");
}
}
You can remove main() method from the code. unzip your gecko driver and save it to your local system with wires.exe.
my sample class path is
G:\ravik\Ravi-Training\Selenium\Marionette for firefox\wires.exe
public class AbstractPage
{
WebDriver Driver;
System.setProperty("WebDriver.gecko.Driver", "C:\\TEMP\\Temp1_geckodriver-v0.10.0-win64.zip");
Driver=new FirefoxDriver();
#Before
public void Homescreen() throws InterruptedException
{
Driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
Driver.get("https://QualityAssurance.com");
Driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
Driver.findElement(By.id("login-form-username")).sendKeys("Login");
Driver.findElement(By.id("login-form-password")).sendKeys("Password");
//JavascriptExecutor js = (JavascriptExecutor) Driver;
//js.executeScript("document.getElementById('login-form-password').setAttribute('value', val );");
}
#After
public void TestComplete() {
Driver.close();
}
#Test
public void Projects() {
Driver.findElement(By.id("quickSearchInput")).sendKeys("WMSSE-229");
Please replace below line
System.setProperty("WebDriver.gecko.Driver", C:\\TEMP\\Temp1_geckodriver-v0.10.0-win64.zip");
You should pass geckodriver.exe not Zip file.
String driverPath = "F:/Sample/Selenium3Example/Resources/";
System.setProperty("webdriver.firefox.marionette", driverPath+"geckodriver.exe");
You can make your code more cleaner when posting here.
You must do something like this:
System.setProperty("webdriver.gecko.driver", "C:/geckodriver.exe");
System.setProperty("webdriver.firefox.bin", "C:/Program Files (x86)/Mozilla Firefox/firefox.exe");
This is a working example, it make you know the context what the above code snippet used
package selenium;
import static org.junit.Assert.fail;
import java.util.concurrent.TimeUnit;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.NoAlertPresentException;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Junit4FirefoxJava {
private WebDriver driver;
private String baseUrl;
private boolean acceptNextAlert = true;
private StringBuffer verificationErrors = new StringBuffer();
#Before
public void setUp() throws Exception {
System.setProperty("webdriver.gecko.driver", "C:/geckodriver.exe");
System.setProperty("webdriver.firefox.bin", "C:/Program Files (x86)/Mozilla Firefox/firefox.exe");
driver = new FirefoxDriver();
baseUrl = "http://www.bing.com/";
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
#Test
public void testJunit4IeJava() throws Exception {
driver.get(baseUrl + "/");
driver.findElement(By.id("sb_form_q")).click();
driver.findElement(By.id("sb_form_q")).clear();
driver.findElement(By.id("sb_form_q")).sendKeys("NTT data");
driver.findElement(By.id("sb_form_go")).click();
driver.findElement(By.linkText("NTT DATA - Official Site")).click();
driver.findElement(By.id("js-arealanguage-trigger")).click();
driver.findElement(By.linkText("Vietnam - English")).click();
driver.findElement(By.id("MF_form_phrase")).clear();
driver.findElement(By.id("MF_form_phrase")).sendKeys("internet");
driver.findElement(By.cssSelector("input.search-button")).click();
}
#After
public void tearDown() throws Exception {
driver.quit();
String verificationErrorString = verificationErrors.toString();
if (!"".equals(verificationErrorString)) {
fail(verificationErrorString);
}
}
private boolean isElementPresent(By by) {
try {
driver.findElement(by);
return true;
} catch (NoSuchElementException e) {
return false;
}
}
private boolean isAlertPresent() {
try {
driver.switchTo().alert();
return true;
} catch (NoAlertPresentException e) {
return false;
}
}
private String closeAlertAndGetItsText() {
try {
Alert alert = driver.switchTo().alert();
String alertText = alert.getText();
if (acceptNextAlert) {
alert.accept();
} else {
alert.dismiss();
}
return alertText;
} finally {
acceptNextAlert = true;
}
}
}
I'm trying to use following code :-
driver.findElement(By.xpath(".//*[#id='attach0']")).sendKeys("first path"+"\n"+"second path""+"\n"third path");
I didn't get result.
you can use AutoIT or JAVA code. Below i have used both for your reference. Try anyone of them
import java.io.IOException;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class AutoITforUpload {
private static WebDriver driver;
private static WebDriverWait waitForElement;
#FindBy(css = "span.btn.btn-success.fileinput-button")
private WebElement Add_files_btn;
#BeforeClass
public static void setUp() {
DesiredCapabilities desicap = new DesiredCapabilities();
System.setProperty("webdriver.chrome.driver", "D:/WorkSpace/Driver/chromedriver.exe");
desicap = DesiredCapabilities.chrome();
driver = new ChromeDriver(desicap);
driver.manage().window().maximize();
driver.get("https://blueimp.github.io/jQuery-File-Upload/");
waitForElement = new WebDriverWait(driver, 30);
}
#Test
public void AutoitUpload() {
// String filepath =
// "D:/Mine/GitHub/BasicProgramLearn/AutoItScript/unnamed.png";
WebElement btn = driver.findElement(By.cssSelector("span.btn.btn-success.fileinput-button"));
String file_dir = System.getProperty("user.dir");
String cmd = file_dir + "\\AutoItScript\\unnamed.png";
System.out.println("File directory is " + file_dir);
try {
// Using ordinary
Thread.sleep(3000);
for(int i=0;i<3;i++) //multiple times upload ;
driver.findElement(By.xpath("//*[#id='fileupload']/div/div[1]/span[1]/input")).sendKeys(cmd);
//use any String Array for multiple files
waitForElement(btn);
btn.click();
Thread.sleep(3000);
System.out.println(file_dir + "/AutoItScript/FileUploadCode.exe");
Runtime.getRuntime().exec(file_dir + "\\AutoItScript\\ChromeFileUpload.exe" + " " + cmd);
} catch (InterruptedException | IOException e) {
e.printStackTrace();
}
}
#AfterClass
public static void TearDown() {
try {
Thread.sleep(5000);
driver.quit();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
private void waitForElement(WebElement vElement) {
waitForElement.until(ExpectedConditions.visibilityOf(vElement));
}
}
The code in AutoIt is
#include<IE.au3>
If $CmdLine[0] < 2 Then
$window_name="Open"
WinWait($window_name)
ControlFocus($window_name,"","Edit1")
ControlSetText($window_name,"","Edit1",$CmdLine[1])
ControlClick($window_name,"","Button1")
EndIf
Hope this gives you an idea
I have successfully created a data driven framework with selenium 1 and trying to do the same using selenium 2 (WebDriver). I was doing some basic R and D. My code is as below.
import java.util.regex.Pattern;
import java.util.concurrent.TimeUnit;
import org.junit.*;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;
import org.testng.annotations.*;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.io.File;
import jxl.*;
#SuppressWarnings("unused")
public class FirstTestusingWebDriver {
private WebDriver driver;
private String baseUrl="http://www.google.co.in";
private StringBuffer verificationErrors = new StringBuffer();
#BeforeClass
public void setUp() throws Exception {
driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
#DataProvider(name="DP")
Object[] createData(){
String[] testData = {"Cheese", "Sudeep"};
System.out.println("Data is getting created");
return testData;
}
#Test(dataProvider="DP")
public void testUntitled(String testData) throws Exception {
driver.get("http://www.google.co.in/");
driver.findElement(By.id("lst-ib")).clear();
driver.findElement(By.id("lst-ib")).sendKeys(testData);
driver.findElement(By.name("btnG")).click();
driver.findElement(By.linkText("Cheese - Wikipedia, the free encyclopedia")).click();
}
#AfterClass
public void tearDown() throws Exception {
driver.quit();
String verificationErrorString = verificationErrors.toString();
if (!"".equals(verificationErrorString)) {
fail(verificationErrorString);
}
}
private boolean isElementPresent(By by) {
try {
driver.findElement(by);
return true;
} catch (NoSuchElementException e) {
return false;
}
}
}
But with this code, the test is not running. Firefox opens and closes while running the test as testNG. Can anyone suggest a proper way to go about it or how to make this work.
just do a slight amendment in ur createData() i.e
import java.util.regex.Pattern;
import java.util.concurrent.TimeUnit;
import org.junit.*;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;
import org.testng.annotations.*;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.io.File;
#SuppressWarnings("unused")
public class FirstTestusingWebDriver {
private WebDriver driver;
private String baseUrl="http://www.google.co.in";
private StringBuffer verificationErrors = new StringBuffer();
#BeforeClass
public void setUp() throws Exception {
driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
#DataProvider(name="DP")
Object[][] createData(){
String[] testData = {"Cheese", "Sudeep"};
System.out.println("Data is getting created");
return new Object[][]{{testData[0]+testData[1]}};
}
#Test(dataProvider="DP")
public void testUntitled(String testData) throws Exception {
driver.get("http://www.google.co.in/");
driver.findElement(By.id("lst-ib")).clear();
driver.findElement(By.id("lst-ib")).sendKeys(testData);
driver.findElement(By.name("btnG")).click();
//driver.findElement(By.linkText("Cheese - Wikipedia, the free encyclopedia")).click();
}
#AfterClass
public void tearDown() throws Exception {
//driver.quit();
String verificationErrorString = verificationErrors.toString();
if (!"".equals(verificationErrorString)) {
fail(verificationErrorString);
}
}
private boolean isElementPresent(By by) {
try {
driver.findElement(by);
return true;
} catch (NoSuchElementException e) {
return false;
}
}}
now it will work fine..