Here is the html for calendar. How to select date using css selector, xpath or something else.
http://wklej.org/id/2772453/ - FIRST CLICK ON CALENDAR
http://wklej.org/id/2772455/ - SECOND CLICK ON CALENDAR
ClickElementById("ctl00_ctl00_ctl00_ContentPlaceHolderCenter_ContentPlaceHolderBody_ContentPlaceHolderBody_dfSalesAgrementData_imgSetDate");
ClickElementByCssSelector("td:contains('Dzisiaj')");
This works. But if i try to click on calendar again and select date this does not work. Only first time date selection works. I cant change date.
I have this. But that works only once too.
ClickElementById("ctl00_MainContentPlaceHolder_dFieldContractEndDate_imgSetDate");
ClickElementByXPath("html/body/div[1]/table/tbody/tr[4]/td[4]");
Your question is a bit hard to understand and based on my understanding, can you please try this?
ClickElementByCssSelector("td[class='day selected today']");
Related
I have to click on day 11 on the calendar but I am unable to construct XPath to perform click operation on that particular date.
I am unable to copy-paste the HTML code here so kindly find the attached image for the HTML and please suggest suitable XPath.
If you need to click on the active day, which is 11 in this case, you can fetch it using its class in the xpath.
Your should be:
//td[#class='active day']
Try this:
CODE
day_that_you_want = "10"
//td[contains(text(), day_that_you_want)]
How to uniquely identify Date and Time selector in a scenario where more than one DateTime Pickers (StartDate and EndDate) shows the same XPATH?
For example,
XPath of Select Date in Start Date(UTC) :
/html/body/div[3]/div1/div/div1/span1/div/input
XPath of Select Date in End Date(UTC) :
/html/body/div[3]/div1/div/div1/span1/div/input
As you can see, both (Start Date and End Date) have same XPATH, but using these XPATH automation via selenium not feasible
snapshot of DateTime Pickers on the same webpage
How to uniquely identify these controls so that it can be automated via Selenium?
Modern web applications modify the DOM a lot to achieve the desired experience.
The actual XPath depends on the click path since the behavior influences the shape of the DOM. On the first click to the startDate, the XPath is
/html/body/div[2]/div[1]/div/div[1]/span[1]/div/input
since the UI library will add the div when the input field is clicked.
When the end Date input field is clicked, another div is created for the popover for end date. This will then be:
/html/body/div[3]/div[1]/div/div[1]/span[1]/div/input
Look for some attributes in DOM corresponding to date-picker element, which makes them unique. If there are such attributes available, you can use them to identify controls uniquely like this
/html/body/div[3]/div1/div/div1/span1/div/input[#attributeName='attributeValue']
In case, there is no unique attributes available and both the date picker control is available, then you can use index to get first and second element using
First element:
/html/body/div[3]/div1/div/div1/span1/div//input[1]
Second element
/html/body/div[3]/div1/div/div1/span1/div//input[2]
I am using bootstrap datepicker. I need to show selected dates from the datepicker to the div at right hand side along with a trash symbol. when i click on trash symbol , the selected date need to be cleared from bootstrap datepicker also. But i do not know how to do it? Do you have any ideas?
I tried:
$('.datepickerBootstrap').datepicker("clearDates");
But it clears all dates.
Also tried with
$('.datepickerBootstrap').datepicker('update', '');
check out my fiddle here: http://jsfiddle.net/f2p8v3co/1/
This should work if you want to clear out the date. Update your fiddle with this code
$('.datepickerBootstrap').datepicker('update', '');
But if you want to update the date then you should use
$('.datepickerBootstrap').datepicker('setDates', '');
Hope it helps
I am trying to fill a textbox value with the current date and I do not want the user to be able to change the date. I want to use a textbox and not a datepicker. I would like the form to load with today's date already loaded in the textbox, which I will then use in my insert query.
I want the date format of yyyy-MM-dd to be in the textbox memberregisterationdate.text. I am not sure where on my form I should put the code either.
Really stuck on this and I can't seem to find it anywhere
Thanks in advance
You have to make it Enabled = False to disable it. You can load it in Form_Load:
memberregisterationdate.Text = Date.Today.ToString("yyyy-MM-dd")
I want to select date from datepicker, below things i tried
Identify the text box in which selected date gets entered.
Identify the datepicker ICON and click on that so that it gets open with current
date highlighted.
Here if I pass required date directly to date text box through sendkeys, it works. But i want to select the date from datepicker which is very old like "10/2/1895", then how to do..?
Html Code:
<img src="/img/default/extjs/s.gif?hash=797058701" class="x-form-trigger x-form-date-trigger " id="ext-gen7">
Clicking on the image which opens dataPickerCalendar
Driver.pFCreateTaskUnderProject.getDpImage().click();
Driver.pFCreateTaskUnderProject.getTxtDateOFBirth()...????????
Here i am not able to proceed. How to select the date[10-2-1952] from the calendar..?
If manual then we will go back to 1952, then select 2nd month and 10th Date. But with automation how to do this...?
Thanks
Mahesh