Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
//button[@id='autoclosable-btn-success']
........................................................................
package com.techbeamers.testing;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;
// Initialize WebDriver
WebDriver driver = new FirefoxDriver();
// Go to URL
driver.get("http://www.myntra.com/");
// Maximize Window
driver.manage().window().maximize();
driver.findElement(By.xpath("//*[text()='Categories']//following::li[1]/label")).cl
ick();
// Hover over the shopping bag icon present on the top navigation bar
Actions mov = new Actions(driver);
mov.moveToElement(driver.findElement(By.xpath("//a[contains(@class,
'cart')]//div"))).click().build().perform();
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
//driver.findElement(By.xpath("//*[contains(@href,'popup.php')]")).click();
String MainWindow=driver.getWindowHandle();
// To handle all new opened window.
Set<String> s1=driver.getWindowHandles();
Iterator<String> i1=s1.iterator();
while(i1.hasNext())
{
String ChildWindow=i1.next();
if(!MainWindow.equalsIgnoreCase(ChildWindow))
{
// Switching to Child window
driver.switchTo().window(ChildWindow);
driver.findElement(By.name("emailid")).sendKeys("gaurav.3n@gmail.com");
driver.findElement(By.name("btnLogin")).click();
// Closing the Child Window.
driver.close();
}
}
// Switching to Parent window i.e Main Window.
driver.switchTo().window(MainWindow);
}
Partial Link Test:
...........................................
Normalize-space
//button[text()[normalize-space()='Features']]
//*[@id="ShopifyMainNav"]/ul[2]/li[1]/div/button
......................................................................
https://phptravels.com/demo/
//*[@id="Popover2"]/div/ul/li[1]/a
//*[@id="Popover2"]/div/ul/li[2]/a
//*[@id="table2"]/tbody/tr[1]/td[1]
//table[@id='table1']//tbody//tr//td[text()='jsmith@gmail.com']
//nav[@id='ShopifyMainNav']//ul//li//div//following-sibling::button[text()
[normalize-space()='Features']]