If we have already logged into Salesforce in a browser and the user name, password is saved is there any way to keep the same so that when we are trying to login via Selenium script, the verification code will not be prompted?.
If I use the below code, it asks for a verification code:
browserdriver.get("https://slim4shady-dev-ed.my.salesforce.com");
browserdriver.manage().timeouts().implicitlyWait(Duration.ofSeconds(20));
browserdriver.findElement(By.id("username")).sendKeys("xxxxxxx@gmail.com");
browserdriver.findElement(By.id("password")).sendKeys("xxxxxxx");
browserdriver.findElement(By.id("Login")).click();
Basically, I'm looking for a solution with the selenium script that uses the info from the previously logged in session or something so that the verification code will not be asked and that it shall directly log into Salesforce.
Please be noted that I'm trying not to add the IP as Trusted and use the browser capabilities (not sure if this is the term).
If you guys can help me with the solution for any one of the browser (Chrome preferably), that would be great.