Posts

Write a program to print Reverse String

# Write a program to print  reverse String   Public station void main(String args[]) { String s="patil"; String rev=""; For(int i=s length-1;i>=0;i++) { rev=rev+s.charAt(i); } System.out.println(rev); } Output: litap

Write a program to print all link present on google page || selenium code

# Write a program to get all links present on google page public static void main(String args[])  {         // Set the system property for the ChromeDriver       System.setProperty("webdriver.chrome.driver","c://desktop//cromedriver.exe");        // create new instance of ChromeDriver      WebDriver driver=new ChromeDriver();      //launch browser --> open google home page    driver.get("https://www.google.com");        // find all links on home page     List<WebElement> links=driver.findElements(By.tagName("//a"));           // Iterate through each link and print the href attribute         for(WebElement link:links)         {           String href=link.getAttribute("href").getText();           System.out.println(href);   ...