Created
December 6, 2018 16:56
-
-
Save seleniumgists/815642f5751e0338fb14a2997c0968a5 to your computer and use it in GitHub Desktop.
generated automatically from #selenium on seleniumhq slack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while(!directoryEmpty) { | |
String dirPath = "C://YEAR_reports"; | |
File dir = new File(dirPath); | |
String[] files = dir.list(); | |
if (files.length == 0) { | |
System.out.println("The directory is empty"); | |
directoryEmpty = true; | |
} else { | |
for (String aFile : files) { | |
System.out.println(aFile); | |
} | |
} | |
//Strip away file extension | |
String companyName = files[0].replaceFirst(".xml$", ""); | |
WebElement DropdownValueBeforeSelect = driver.findElement(By.tagName("option")); | |
String CurrentDropDownSelections = DropdownValueBeforeSelect.getText(); | |
System.out.println(CurrentDropDownSelections); | |
WebElement SaveSelectedFile = driver.findElement(By.name("saveButton")); | |
SaveSelectedFile.click(); | |
try { | |
Thread.sleep(500); | |
} catch (InterruptedException e) { | |
e.printStackTrace(); | |
} | |
// CloseTab, button may be out of visible area, just send Enter. | |
WebElement CloseTab = driver.findElement(By.name("closeButton")); | |
CloseTab.sendKeys(Keys.ENTER); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment