Posts

Showing posts from August, 2024

Comprehensive Selenium WebDriver Syntax for Effective Test Automation

Comprehensive Selenium WebDriver Syntax for Effective Test Automation public static void main(String[] args ) throws InterruptedException, IOException { System. setProperty ( "webdriver.chrome.driver" , "./Drivers/chromedriver.exe" ); WebDriver driver = new ChromeDriver(); driver .manage().window().maximize(); driver .manage().timeouts().implicitlyWait(30, TimeUnit. SECONDS ); driver .get( "https://www.w3schools.com/html/html5_draganddrop.asp" ); //Actions MouseOver WebElement src = driver .findElement(By. xpath ( "//input[@id='name']" )); WebElement trg = driver .findElement(By. xpath ( "//input[@id='city']" )); Actions action = new Actions( driver ); action .dragAndDrop( src , trg ).build().perform(); action .contextClick( src ).build().perform(); action .moveToElement( src ).build().perform(); //DropDown WebElement country = driver .findElement(By. xpath ( "//input[text()='country']" )); Selec