I am getting the below error when i try to login and select a drop down in login page using selenium webdriver in IE11.
[{
DesiredCapabilities capabilities=DesiredCapabilities.internetExplorer();
capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
System.setProperty("webdriver.ie.driver", "C://Users//chetana.inamdar//Desktop//selenium//IEDriverServer.exe");
WebDriver driver = new InternetExplorerDriver(capabilities);
driver.navigate().to("url");
driver.findElement(By.id("ctl00_plhContent_txtUserName")).sendKeys("username");
driver.findElement(By.id("ctl00_plhContent_txtPassword")).sendKeys("Password");
driver.findElement(By.id("ctl00_plhContent_btnLogin")).click();
driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);
//Select dropdown=new Select(driver.findElement(By.xpath(".//*[#name='ctl00$plhContent$Tabs$pnltabPermanentArea$ddlIDSearch']")));
Select dropdown=new Select(driver.findElement(By.name("ctl00$plhContent$Tabs$pnltabPermanentArea$ddlIDSearch")));
dropdown.selectByValue("CS Number");
System.out.println("the output of selected is"+driver.findElement(By.id("ctl00_plhContent_Tabs_pnltabPermanentArea_ddlIDSearch")).isSelected());
driver.findElement(By.id("ctl00_plhContent_Tabs_pnltabPermanentArea_txtIDSearch")).sendKeys("1234");
}]
Error:
Related
OS Build Number:- 18363.900
Edge Version: 83.0.478.54
MicrosoftWebDriver Version: 83.0.478.54
Here is the code:
System.Environment.SetEnvironmentVariable("webdriver.edge.driver", "E:\\edgedriver_win64\\msedgedriver.exe");
IWebDriver driver = new EdgeDriver();
I am getting error as: OpenQA.Selenium.WebDriverException: 'Unexpected error. Unknown error'
Which version of Selenium WebDriver are you using? I suggest you to use the latest version 4.0.0-alpha05 and use the code below:
EdgeOptions edgeOptions = new EdgeOptions();
edgeOptions.UseChromium = true;
edgeOptions.BinaryLocation = #"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe";
var msedgedriverDir = #"D:\webdriver83.0.478.54";
var driver = new EdgeDriver(msedgedriverDir, edgeOptions);
driver.Navigate().GoToUrl("https://bing.com");
Thread.Sleep(3000);
driver.Close();
Note: Change the paths in the code to your owns.
Result:
I am unable to access through this lock icon and get to login. I have used different locator options.
The current code I am using:
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);
driver.get("example.com");
driver.manage().window().maximize();
driver.findElement(By.id("login-trigger")).click();
driver.findElement(By.id("username")).sendKeys("User1");
driver.findElement(By.id("password")).sendKeys("123456");
driver.findElement(By.id("submit")).click();
Instead of writing driver.findElement(By.id("submit")).click();
try this : driver.findElement(By.id("submit")).sendKeys(Keys.ENTER);
When I am trying to run the AutoIT.exe script or my Selenium script, it is throwing 'File Not found error'. Please suggest!
Selenium code snippet: ===================================
public static void main(String[] args) throws Exception { System.setProperty("webdriver.chrome.driver", "C:\\Users\\IBM_ADMIN\\Desktop\\Drivers\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("http://demo.automationtesting.in/Register.html");
driver.manage().window().maximize(); Thread.sleep(2000);
driver.findElement(By.xpath("//input[#id='imagesrc' and #type='file']")).click();
Runtime.getRuntime().exec("C:\\Users\\IBM_ADMIN\\Desktop\\Selenium practise\\SeleniumAssignment\\AutoIT\\MultipleFileUpload.exe"+" "+"C:\\Users\\IBM_ADMIN\\Desktop\\0234_005.pdf"); Thread.sleep(2000);
driver.findElement(By.xpath("//input[#id='imagesrc' and #type='file']")).click();
Runtime.getRuntime().exec("C:\\Users\\IBM_ADMIN\\Desktop\\Selenium practise\\SeleniumAssignment\\AutoIT\\MultipleFileUpload.exe"+" "+"C:\\Users\\IBM_ADMIN\\Desktop\\BRP_SujataChakraborty.pdf"); driver.quit(); }
AutoIt Code Snippet: ============================
ControlFocus("Open","","Edit1")
ControlSetText("Open","","Edit1",$CmdLine[0])
ControlSetText("Open","","Edit1",$CmdLine[1])
ControlSetText("Open","","Edit1",$CmdLine[2])
ControlClick("Open","","Button1")
Is brower file dialog active window? If not auto it script will enter value in window whichever is active. Do make sure file dialog active?. Do interact with brower once it is started. And one more thing if you input type is file then you can use send keys instead of auto it to enter value.
Selenium Webdriver runtime Exception: unexpected alert "Please close other open tabs of the application and re-open this activity", even though there are no other tabs open.
The Automation scripts were working fine, but recently I am getting the above exception.The Screenshot of the Alert:
I tried with different versions of chrome, selenium stand alone driver, but the issue still exist. Why is this alert coming, even though the application is not open in any of the tabs or browsers other than the one execution through online?
If this pop up is coming at some specific location every time then you can simply accept it by writing below lines :
WebDriver wb=new ChromeDriver();
wb.switchTo().alert().accept();
Else if any unexpected pop up is coming ,while initializing the driver then you can use the below code :
ChromeOptions options = new ChromeOptions();
Map<String, Object> prefs = new HashMap<String, Object>();
prefs.put("profile.default_content_settings.popups", 0);
String path=new GetBasePath().getPath_XML()+dir;
prefs.put("download.default_directory", path);
options.addArguments("disable-extensions");
prefs.put("credentials_enable_service", false);
prefs.put("password_manager_enabled", false);
options.setExperimentalOption("prefs", prefs);
options.addArguments("chrome.switches","--disable-extensions");
options.addArguments("--test-type");
DesiredCapabilities cap = DesiredCapabilities.chrome();
cap.setCapability(ChromeOptions.CAPABILITY, options);
cap.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR, UnexpectedAlertBehaviour.ACCEPT);
System.setProperty("webdriver.chrome.driver",**path to chromedriver.exe**"));
WebDriver wb= new ChromeDriver(cap);
My personal opinion , use both.
I was trying to launch safari browser on real device(iPhone 4) using appium. but it is giving following error.
Unable to install [/var/folders/7_/fz8kyhyn2g97s1m9zylk50xc0000gq/T/11545-10782-1dp1wfm/submodules/SafariLauncher/build/Release-iphoneos/SafariLauncher.app] to device with id [fdaxxx76].
Error [Error: Command failed: /bin/sh -c /Applications/Appium.app/Contents/Resources/node_modules/appium/build/fruitstrap/fruitstrap install --id fda51be7184f865f02de4f4c6cb8fff760964e76 --bundle "/var/folders/7_/fz8kyhyn2g97s1m9zylk50xc0000gq/T/11545-10782-1dp1wfm/submodules/SafariLauncher/build/Release-iphoneos/SafariLauncher.app"
Below is my sample code:
DesiredCapabilities cap = new DesiredCapabilities();
private static WebDriver driver;
#BeforeTest
public void prep() throws MalformedURLException {
System.out.println("Script started");
cap.setCapability("platformName", "iOS");
cap.setCapability("platformVersion", "8.3");
cap.setCapability("deviceName", "iPhone4");
cap.setCapability("udid", "fda51be7184f865f02de4f4c6cb8fff760964e76");
cap.setCapability("browserName", "Safari");
driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), cap);
}
#Test
public void googleTest() {
System.out.println("main method");
driver.get("http://google.com");
}
You need to create a provisioning profile to deploy it to a real device.
Follow instructions here.
Hope this helps,
Liam