Выберите конкретную дату jQuery UI Datepicker

Как говорится в строке справки, они «реализованы в самой CLR», поэтому вам нужно проконсультироваться со своими источниками или дизассемблерами C ++.

Как правило, файлы, которые содержат механизм CLR, являются несколько родных DLL в папке %WINDIR%\Microsoft.NET\Framework\<.NET engine version>, в основном mscor*.dll и clr.dll. Корневая .NET DLL, mscoree.dll, находится в System32, но кажется, что она действует только как пусковая установка.

Поскольку реализации метода InternalCall являются деталями реализации, нет никакой гарантии, что эти методы осуществляется последовательно, например что существует даже некоторый глобальный реестр.

Например. дизассемблирование показывает, что встроенные методы .NET 4 System.String реализованы в clr.dll и указаны в структуре, подобной каталогу, тогда как System.Deployment.Application.NativeMethods.IClrRuntimeInfo поддерживается классом COM CLRRuntimeInfoImpl COM в mscoreei.dll, методы просто являются его виртуальные функции.

-1
задан Mate Mrše 17 January 2019 в 08:32
поделиться

1 ответ

Перейдите в место, где открыты календарь и часы, а затем выполните итерацию в соответствии с необходимой датой и временем.

Надеюсь, приведенный ниже код сработает для вас.

import java.util.Calendar;

import java.util.List;

import java.util.concurrent.TimeUnit;

import org.openqa.selenium .By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.WebElement;

import org.openqa.selenium.firefox.FirefoxDriver;

import org.testng.annotations.Test;

открытый класс DatePicker {

@Test

public void testDAtePicker() throws Exception{

    //DAte and Time to be set in textbox

    String dateTime ="12/07/2014 2:00 PM";

    WebDriver driver = new FirefoxDriver();

    driver.manage().window().maximize();

    driver.get("http://demos.telerik.com/kendo-ui/datetimepicker/index");

    driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

    //button to open calendar

    WebElement selectDate = driver.findElement(By.xpath("//span[@aria-controls='datetimepicker_dateview']"));

selectDate.click();

//button to move next in calendar

WebElement nextLink = driver.findElement(By.xpath("//div[@id='datetimepicker_dateview']//div[@class='k-header']//a[contains(@class,'k-nav-next')]"));

//button to click in center of calendar header

WebElement midLink = driver.findElement(By.xpath("//div[@id='datetimepicker_dateview']//div[@class='k-header']//a[contains(@class,'k-nav-fast')]"));

//button to move previous month in calendar

WebElement previousLink = driver.findElement(By.xpath("//div[@id='datetimepicker_dateview']//div[@class='k-header']//a[contains(@class,'k-nav-prev')]")); 

    //Split the date time to get only the date part

    String date_dd_MM_yyyy[] = (dateTime.split(" ")[0]).split("/");

    //get the year difference between current year and year to set in calander

    int yearDiff = Integer.parseInt(date_dd_MM_yyyy[2])- Calendar.getInstance().get(Calendar.YEAR);

    midLink.click();

    if(yearDiff!=0){

        //if you have to move next year

        if(yearDiff>0){

            for(int i=0;i< yearDiff;i++){

                System.out.println("Year Diff->"+i);

                nextLink.click();

            }

        }

        //if you have to move previous year

        else if(yearDiff<0){

            for(int i=0;i< (yearDiff*(-1));i++){

                System.out.println("Year Diff->"+i);

                previousLink.click();

            }

        }

    }

    Thread.sleep(1000);

    //Get all months from calendar to select correct one

    List<WebElement> list_AllMonthToBook = driver.findElements(By.xpath("//div[@id='datetimepicker_dateview']//table//tbody//td[not(contains(@class,'k-other-month'))]"));

    list_AllMonthToBook.get(Integer.parseInt(date_dd_MM_yyyy[1])-1).click();

    Thread.sleep(1000);

    //get all dates from calendar to select correct one

    List<WebElement> list_AllDateToBook = driver.findElements(By.xpath("//div[@id='datetimepicker_dateview']//table//tbody//td[not(contains(@class,'k-other-month'))]"));

    list_AllDateToBook.get(Integer.parseInt(date_dd_MM_yyyy[0])-1).click();

    ///FOR TIME

    WebElement selectTime = driver.findElement(By.xpath("//span[@aria-controls='datetimepicker_timeview']"));

    //click time picker button

    selectTime.click();

    //get list of times

    List<WebElement> allTime = driver.findElements(By.xpath("//div[@data-role='popup'][contains(@style,'display: block')]//ul//li[@role='option']"));

    dateTime = dateTime.split(" ")[1]+" "+dateTime.split(" ")[2];

 //select correct time

    for (WebElement webElement : allTime) {

        if(webElement.getText().equalsIgnoreCase(dateTime))

        {

            webElement.click();

        }

    }

}

}

Для получения более подробной информации вы можете перейти по ссылке ниже.

https://www.guru99.com/handling-date-time-picker-using-selenium.html

0
ответ дан mauryaAjay 17 January 2019 в 08:32
поделиться
Другие вопросы по тегам:

Похожие вопросы: