Go to the Official Website of Jquery https://jqueryui.com/datepicker/
It's not allow be to click on input text even it's have unique id="datepicker" getting an error element not found Exception but when i runs locally by adding jquery date picker it works likes a charm. can somebody help me can't able to figure it out!
2) By using this url i can select anything but it not works with jquery official site as i mentioned above https://jqueryui.com/resources/demos/datepicker/default.html
Below is my actual code that is not getting work
System.setProperty("webdriver.chrome.driver","C:\\ProgramFiles\\chromedriver.exe");
driver=new ChromeDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
driver.get("https://jqueryui.com/datepicker/");
Thread.sleep(5000);
driver.findElement(By.id("datepicker")).click();
The element with id="datepicker" is within a frame. So we have to switch to the intended frame first, then locate the element and then call the click() method as follows:
System.setProperty("webdriver.chrome.driver", "C:\\Utility\\BrowserDrivers\\chromedriver.exe");
WebDriver driver=new ChromeDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
driver.get("https://jqueryui.com/datepicker/");
driver.switchTo().frame(driver.findElement(By.xpath("//iframe[#class='demo-frame'][#src='/resources/demos/datepicker/default.html']")));
driver.findElement(By.id("datepicker")).click();
System.out.println("Datepicker Clicked");
Related
I am trying to detect the login id and password field of a website : https://mretailstore.com/login but seems selenium is not able to locate the email type box. I have checked stackoverflow but didn't get any solution to this. Someone has used iframe because of what he/she was facing the same issue but here we have not incorporated any iframe.
The error I am getting is:
Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to locate element: .//*[#id='identity']
The code I am using:
System.setProperty("webdriver.gecko.driver", "C:\\Users\\MI SERVICE\\Downloads\\geckodriver.exe");
FirefoxOptions capa = new FirefoxOptions();
capa.setCapability("marionette", true);
WebDriver driver = new FirefoxDriver(capa);
driver.get("https://www.mretailstore.com/");
driver.findElement(By.xpath(".//*[#id='identity']")).sendKeys("abc#d.com");
driver.findElement(By.xpath(".//*[#id='password']")).sendKeys("abc123");
driver.findElement(By.id("loginbutton")).click();
driver.navigate().back();
driver.close();
It looks your xpath is correct only and this exception is happening before element rendering.So, Please add the some explicit wait after the page loading.
It is working for me with/without Explicit Wait.
Code:
driver.get("https://www.mretailstore.com/");
WebDriverWait wait=new WebDriverWait(driver,20);
wait.until(ExpectedConditions.titleIs("Login"));
driver.findElement(By.xpath(".//*[#id='identity']")).sendKeys("abc#d.com");
driver.findElement(By.xpath(".//*[#id='password']")).sendKeys("abc123");
driver.findElement(By.id("loginbutton")).click();
I have to click on tooltip which then opens a popup. I am unable to click on it and i get an error - no such element found.
Can anyone please help me on this. I'm sure im making some mistake in xpath.
Can you try this code.
public static void main(String[] args)
{
System.setProperty("webdriver.gecko.driver", "/home/santhoshkumar/Softwares/Selenium/drivers/geckodriver");
WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
driver.get("https://compare.giffgaff.com/creditcards#/results/zeroPercentBalanceTransfer");
driver.findElement(By.xpath("//h4[contains(text(),'Calculate potential savings')]/parent::div/div[1]//div[#class='c-tooltip']//span")).click();
}
I tried to use ChromeDrive but getting error or not excuted well.
My simple java code for testing was:
#Test
public void testGoogleSearch() {
System.setProperty("webdriver.chrome.driver", "lib\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("http://www.google.com/xhtml");
Thread.sleep(5000); // Let the user actually see something!
WebElement searchBox = driver.findElement(By.name("q"));
searchBox.sendKeys("ChromeDriver");
searchBox.submit();
Thread.sleep(5000); // Let the user actually see something!
driver.quit();
}
Following this tutorial:
https://sites.google.com/a/chromium.org/chromedriver/getting-started
SOLVED
I need to update the ChromeDrive and replace the previous one.
Under my project directory /lib
Download here: https://sites.google.com/a/chromium.org/chromedriver/downloads
yes, i suggest you can mention like this C:\\Users\\mona\\Downloads\\chromedriver_win32\\chromedriver.exe
I am getting following error message, when i tried below codes. Is it a bug in Selenium?
Sep 19, 2014 10:01:09 PM
org.openqa.selenium.os.UnixProcess$SeleniumWatchDog destroyHarder
INFO: Command failed to close cleanly. Destroying forcefully (v2).
org.openqa.selenium.os.UnixProcess$SeleniumWatchDog#15ae139
Scenario 1:
WebDriver driver=new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.get("http://www.google.com");
System.out.println(driver.getTitle());
driver.navigate().to("http://www.yahoo.com");
System.out.println(driver.getTitle());
driver.quit();
Scenario 2:
WebDriver driver=new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.navigate().to("http://www.google.com");
System.out.println(driver.getTitle());
driver.navigate().to("http://www.yahoo.com");
System.out.println(driver.getTitle());
driver.quit();
From the Selenium API:
navigate()
An abstraction allowing the driver to access the browser's history and
to navigate to a given URL.
(emphasis is mine) So unless you somehow populate the history first, your code should fail all the time.
I am a new user of Selenium. I want to use it to start up the Chrome browser but I have a problem.
public static void processor(String url, String name) {
System.setProperty("webdriver.chrome.driver", "C:/Documents and Settings/jingxiong/Local Settings/Application Data/Google/Chrome/Application/chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get(url);
WebElement element = driver.findElement(By.name(name));
element.sendKeys("google");
element.submit();
System.out.println("Page title is: " + driver.getTitle());
driver.quit();
}
When I run this example the Chrome browser starts ok but without configured plugins, my settings or bookmarks. What should I do to cause it load these?
Thank you.
You should first read chromedriver document in selenium wiki. Its available here - http://code.google.com/p/selenium/wiki/ChromeDriver
As mentioned in the wiki:-
Similarly, to load an extension when Chrome starts:
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability("chrome.switches", Arrays.asList("--load-extension=/path/to/extension/directory"));
WebDriver driver = new ChromeDriver(capabilities);