Classes and Methods Flashcards
Pass URL to browser
driver.get(“ur”);
driver.navigate().to(“url”);
Get the current url from webpage
driver.getCurrentUrl();
Get the Page source
driver.getPageSource();
navigate page back and forward
driver.navigate().back();
driver.navigate().forward();
Close the current tab and All Tabs
driver.close();
driver.quit();
Maximize window
driver.manage().window().maximize();
Page Load
driver.manage().timeouts().pageLoadTimeout( 10, TimeUnit.SECONDS);
Implicit Wait
driver.manage().timeouts().implicitlyWait( 10, TimeUnit.SECONDS);
Pass text/String/data and use keyboard
WebElement.sendKeys(“text here”);
WebElement.sendKeys(Keys.ARROW_DOWN);
WebElement.sendKeys(Keys.DOWN);
WebElement.sendKeys(Keys.ARROW_UP);
WebElement.sendKeys(Keys.UP);
Clear data
WebElement.clear();
Get the data/Text
WebElement.getText();
Click on webElement
WebElement.click();
Refresh webpage
driver.navigate().refresh();
Delete All cookies or specific cookies
driver.manage().deleteAllCookies();
driver.manage().deleteCookieNamed(“name specific here”);
Actions class syntax
Actions act = new Actions(driver);