Selenium Java to get the tag name
KW.java
import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; class KW { public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "/home/kodingwindow/drivers/chromedriver"); WebDriver driver = new ChromeDriver(); driver.get("https://kodingwindow.com/testapp/"); System.out.println(driver.findElement(By.name("username")).getTagName()); System.out.println(driver.findElement(By.name("password")).getTagName()); System.out.println(driver.findElement(By.name("login")).getTagName()); driver.close(); } }
Output
input input button
Comments and Reactions
What Next?
Selenium Java to get the title of a given webpage using the getAttribute() method
Selenium Java to get the current date and time using sendKeys
Selenium Java to clear and enter the value in an input field
Advertisement