A customer relationship management system like Microsoft’s Dynamic CRM (MSD-CRM) can be customized but has generic features. So, every user has access to generic features but for each user/customer there are different URLs. So, suppose you have to automate the CRM for multiple user having the same features but different URL and for that you are creating multiple scripts which is unnecessary and time consuming. If you can pass the URL at runtime then for every user you can automate one script. |
Code given below should be used before driver.get(“URL”);
//JavascriptExecutor js = (JavascriptExecutor)driver;
//js.executeScript(“var pr=prompt(‘Enter your URL please:’,”);
//alert(pr);”); //Thread.sleep(15000L);
//String URL = driver.switchTo().alert().getText();
//driver.switchTo().alert().accept();
When you first run the above given code, the Javascript prompt box will appear. First the browser will open and the prompt box will ask “Enter your URL please”. You have 15 secs to enter the URL or the process will fail. After entering the URL, hit “Enter”. The browser will navigate to the URL. |