How do you pass today's date with send_keys in selenium?
input.send_keys(print(date.today()))
When I try this, it says None.
I kept playing with it, basically I came up with this:
d = datetime.date.fromordinal(datetime.date.today().toordinal()-7).strftime("%m/%d/%Y")
date1.send_keys(d)
Related
I actually face a problem with react I did not expect so far. Actually I have a google-react-chart Calender and an array, that I have parsed from different Date formats in one. Now i want to parse through my array and to map it's data to my google-react-chart calender. Unfortunatley I did most of my coding on the web in php so far, and guys, I don't have any idea how I can bring this construction to work :))
I tried to replace my hard coded data with a mapping function, but - as you may know - that only leads to a parsing error :)
So my simple question is: How can I process my arrayData to my Google react chart calender?
//did not work
mydateArray.map((item) =>{JSON.parse{item)}
The problem is that you are trying to parse a string, instead of a JSON object.
If you are getting this array from PHP, try passing it as a json_encode($variable), but not with the new Date() class. You can just pass it as the date string itself in the first position and the amount in the second position of the array;
Assuming you have the date and the data as something like this in PHP (before the json_encode):
$variable = [['MM/DD/YYYY', 50126],['MM/DD/YYY', 50126], and so on];
After you pass to React your PHP variable (via fetch or the dataset),
you can do something like:
mydateArray = JSON.parse(phpVariable);
and THEN, you can map it:
mydateArray.map(item => [new Date(item[0]), item[1]);
Just some Date warnings:
- Date in javascript must be constructed using Month/Day/Year, unfortunatelly. There is no createFromFormat, like PHP.
- The date ranges from 0 to 11, so october (10th month) must be written as 09/day/year, and so on.
I have a string with a full date like this: "2016/03/05 13:47:18 +0000".
I want covert it to "2016-03-05" or "05-March-2016" on Angular scope. I also have integer time duration = 421471 which I want to convert to a time format like "23:45" or "1 hour , 50 minute".
{{sound.created_at | date}}
{{sound.duration}}
How can I do that?
To solve your issue please use momentjs as very famous lib to deal everything about date in js.
To make it work well with Angularjs/4, please have a look here.
How to get Date Value from Excel cell to Sendkeys() method if I use object as a variable? An error occuring at sendkeys like Charsequence[].
object x=sheet.getRow(8).getCell(1).getStringCellValue();
wd.findElement(By.id("MyMember_DateOfBirth")).sendKeys(x);
The method takes a charSquence/String, I'll assume that you get the content from the Sheet as a String reading the index or cell value.
Here is the Javadoc link might help
http://selenium.googlecode.com/git/docs/api/java/index.html
void sendKeys(java.lang.CharSequence... keysToSend)
Hope this helps
never worked a lot on apache poi, but going through the api I would suggest you to take the date value in cell through
Date d=sheet.getRow(8).getCell(1).getDateCellValue();
Later you can use SimpleDateFormat class to get your date in string format.
or else you can use DataFormatter class in poi and use formatCellValue method for your usage.
Hope it helps.
I'm using the CakeTime class for my localization of dates & times.
For dates it works like I want it to:
$timestring = $this->Time->format('Y-m-d H:i:s', time());
echo 'DateTime: '.$this->Time->i18nFormat($timestring);
// Result => DateTime: 11/08/2013
I want it to also display the time.
For example in the US they use AM/PM and in other places they use the 24 hour notation.
I've looked but can't seem to find a way to do this.
Any idea's?
Edit*
To be clear, the localization works perfectly for the dates(have the LC_TIME files), but the i18nFormat function only returns the date, and from what i saw, passing a format will use that format, not the localized one, example MM/DD/YYYY vs DD.MM.YYYY in a different locale
*Edit2:
The solution vicocamacho gave in the comments is the correct one
So to get the Date + Time in the localized form:
$this->Time->i18nFormat(time(), '%x %X') does the trick!
You can use the TimeHelper::i18nFormat method. You also can check this repo to find common date/time translations https://github.com/cakephp/localized be sure to store them in the APP/locale/<locale>/LC_TIMEdirectory
I am using date picker of extjs 4.
I need to enable only three dates and
to disable everything else. How
do I do it ?
I would suggest starting with the API docs for Ext.menu.DatePicker, which I assume that you are doing.
However, if there are only a total of three static dates ever available, why not use something besides a date picker for the task?
If you are picking from a set of dates that could be stored in an array, I'd suggest reading this Sencha forum post about using DateField along with an array that disables all dates other than those specified in an array as follows:
dateArray = ["06/17/2007", "06/01/2007", "05/17/2007", "05/01/2007"];
dateField = new Ext.form.DateField({
format: "m/d/Y",
disabledDates: ["^(?!" + dateArray.join("|") + ").*$"],
disabledDatesText: "Date not available."
});