1

I have downloaded and imported Selenium 3.60 jars but unable to import packages:

package basics;

import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;


public class Synchronization {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        System.setProperty("webdriver.gecko.driver","N://drivers//geckodriver.exe");
        WebDriver driver=new FirefoxDriver();
        //driver.manage().timeouts().implicitlyWait(5,TimeUnit.SECONDS); //implicit wait
        driver.get("https://alaskatrips.poweredbygps.com/g/pt/hotels?MDPCID=ALASKA-US.TPS.BRAND.hotels.HOTEL");
        driver.findElement(By.id("H-destination")).sendKeys("nyc");
        driver.findElement(By.id("H-destination")).sendKeys(Keys.TAB); //tab operation
        driver.findElement(By.id("H-fromDate")).sendKeys(Keys.ENTER); 

        WebDriverwait d=new Webriverwait(5,driver);

        driver.findElement(By.xpath(".//a[contains(@href,'North-Bergen-Hotels-Howard-Johnson')]")).click();



    }

}
5
  • What is your problem? This is just the code. What are the symptoms? – Alexey R. Oct 17 '17 at 15:21
  • The thing is when i initialize the WebDriver wait class,i am not able to import anything related to it,hence could not execute it.So,is there any external jars to import.I have imported all jars under Selenium 3.6.0 – NeHa NeHz Oct 17 '17 at 15:33
  • Do you have selenium jars attached to your eclipse project or pom.xml dependencies configured (in case if you use maven) ? – Alexey R. Oct 17 '17 at 15:38
  • I attached selenium jars to eclipse and i dont have pom.xml as i am not using maven. I have downloaded Java 3.6.0 jars from seleniumhq.org/download – NeHa NeHz Oct 17 '17 at 15:39
  • In the downloaded selenium jars,there are very limited jars around 10.I am wondering whether 3.6.0 version minimized the jars or i have done wrong somewhere? – NeHa NeHz Oct 17 '17 at 16:12
1

I think some problems right here are following:

  1. You are trying to use constructor of the class WebDriverWait to behave as a method of waiting for 5 seconds for some action. This won't work.
  2. There is no constructor for the class WebDriverWait that takes first argument as integer (in your code you're passing 5) From the official http://seleniumhq.github.io/selenium/docs/api/java/index.html

enter image description here

Try to implicitly import (I mean type in your class) package org.openqa.selenium.support.ui and see it this would help.

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.