@Test public void test_login_using_relative_locators_3(){ WebElement txt_name = driver.findElement(withTagName("input") .toLeftOf(By.id("addbutton")) .below(By.name("li5"))); txt_name.sendKeys("Relative locators test"); // Get details of the Submit/Add button WebElement submitbutton = driver.findElement(By.xpath("//*[@id=\'addbutton\']")); // Submit the new entry submitbutton.click(); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); }