Showing posts with label development. Show all posts
Showing posts with label development. Show all posts

Tuesday, March 12, 2019

Data provider in TestNG

 package muttu.test;  
 import org.testng.annotations.DataProvider;  
 import org.testng.annotations.Test;  
 public class DataProviderDemo {  
      @DataProvider(name = "LoginDeatls")  
      public Object[][] getUserDetails() {  
           return new Object[][] { { "uName1", "pwd1" }, { "uName2", "pwd2" } };  
      }  
      @Test(dataProvider = "LoginDeatls")  
      public void Login(String name, String password) {  
           System.out.println(name);  
           System.out.println(password);  
      }  
 }  

Friday, March 8, 2019

Select an Item from the drop-down in selenium webdriver

 package learning;  
 import java.util.concurrent.TimeUnit;  
 import org.openqa.selenium.By;  
 import org.openqa.selenium.WebDriver;  
 import org.openqa.selenium.chrome.ChromeDriver;  
 import org.openqa.selenium.support.ui.Select;  
 public class Dropdown {  
      public static void main(String[] args) {  
           System.setProperty("webdriver.chrome.driver", "C:\\chromedriver.exe");  
           WebDriver driver = new ChromeDriver();  
           driver.manage().window().maximize();  
           driver.manage().deleteAllCookies();  
           driver.manage().timeouts().pageLoadTimeout(40, TimeUnit.SECONDS);  
           driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);  
           driver.get("https://html.com/attributes/select-size/?utm_source=network%20recirc&utm_medium=Bibblio");  
           //Select dropdown by Select class  
           Select select = new Select(driver.findElement(By.xpath("//select")));  
           //select required item from the above dropdown  
           select.selectByValue("Lesser");  
      }  
 }  

Sunday, March 25, 2018

[Android App Development] Re-load app after permission granted

@Override

public void onRequestPermissionsResult(int requestCode, @NonNull String[] 
permissions, @NonNull int[] grantResults) {
    Intent permiIntent=new Intent(this,MainActivity.class);
    finish();
    startActivity(permiIntent);
}