Senaryo: eski ayı ve yeni Ay'ı karşılaştırır ve her ikisi de eşit değilse yeni ayın raporunu karşıdan yükler. Burada Açılır menüde bir seçenek webdriver tarafından okunmuyor
sitesi link: http://www.depreportingservices.state.pa.us/ReportServer/Pages/ReportViewer.aspx?%2fOil_Gas%2fOil_Gas_Well_Historical_Production_ReportO tüm okur ve Ocak 2016 ve yüklemeler rapor ve doğrudan Nov için atlama yerine Aralık rapor indirip okur Tüm seçeneği yok sayar. Statik eski ay i olan bir txt dosyasından alıyorum:
WebElement selectElement = driver.findElement(By.id("ReportViewerControl_ctl04_ctl03_ddValue"));
//Getting the count of the values in the drop down list
Select listBox = new Select(selectElement);
int size1 = listBox.getOptions().size();
//prints the size to the console
System.out.println("Total no. of months in the drop down is:"+ size1);
System.out.println("The old month is: " + oldMonth);
//String newMonth ="";
//listBox.selectByIndex(3);
String newMonth ;
for (int i = 1; i < size1; i++) {
WebElement mSelectElement = driver.findElement(By.xpath(".//*[@id='ReportViewerControl_ctl04_ctl03_ddValue']"));
List<WebElement> optionsList = mSelectElement.findElements(By.tagName("option"));
WebElement element = optionsList.get(i);
newMonth = element.getText();
//Message that prints the new month
System.out.println("The new month is:"+newMonth);
/*Condition to check if the New month is equal to Old month, if it is not equal then proceeds
* to download that particular month data or else breaks the loop
*/
if (!oldMonth.equals("All") & !newMonth.equals("All")) {
if (oldMonth.equals(newMonth)) {
System.out.println("No new months are available to download");
Wait(10000);
driver.close();
break;
}//else if (i==1 || (oldMonth.equals(newMonth))) {
//else if (i==1 & !(oldMonth.equals(newMonth))) {
else if (!(oldMonth.equals(newMonth))) {
download report
}
döngü
için
Lütfen eski aydan yeni aya kadar olanları karşılaştır onaylayın –
i statik olarak ayarladım Bir txt dosyası yukarı = Ekim 2015 ay olacak, txt dosyasından dizeyi karşılaştıracağım. Yeniay, seçimdeki "Tümü" den başlıyor. Hepsi! = Ekim 2015, Ocak! = Ok 2015 vs ... – user2762008