Rselenium: Submit date form - rselenium

I am trying to submit a date form on this web page:
url <- "https://www.bcra.gob.ar/PublicacionesEstadisticas/Cotizaciones_por_fecha_2.asp"
library(RSelenium)
library(rvest)
library(XML)
date <- "01/01/2020"
rD <- rsDriver(browser = "firefox")
remDr <- rD[["client"]]
remDr$navigate(url)
Having navigated to the page, if I manually input a date I can submit the form like this:
remDr$findElements("class", "form-group")[[2]]$clickElement()
However I haven't been able to submit my chosen date. I have tried:
remDr$findElement(using = "class",
value = "form-group")$sendKeysToElement(list(date))
But this does nothing. I think I might need click on the calendar icon before selecting a date. The following opens the calendar selector:
remDr$findElements("class", "tcal")[[1]]$clickElement()
But after this I am stuck -- how do I select a date? There are a few similar queries on SO but none seems exactly the same.

Related

How to handle date picker in Cypress

How to select a past date in the DOB field? What Javascript function can I use in Cypress automation?
It is not a free text field, only can select from the date picker. Here is the screenshot and the HTML
<input _ngcontent-kgi-c484="" id="dob" formcontrolname="dob" readonly=""
bsdatepicker="" placeholder="Optional" class="form-control
plore-form-control ng-valid ng-touched ng-dirty" ng-reflect-name="dob"
ng-reflect-bs-config="[object Object]"
ng-reflect-max-date="Fri Apr 16 2021 00:00:00 GMT+1">
I tried this function but it didn't work
cy.get('#dob').invoke('val').then((text) => {
expect('08/05/1999').to.equal(text);
What I did was add a custom command (we have various datepickers throughout our system, each having a slightly different selector).
Cypress.Commands.add("setDateInput", (selector, value) => {
// wait for the flatpickr instance to be applied before setting the date
// 'flatpickr-input' class is added on initiation
cy.get(`${selector}.flatpickr-input`).then($el => {
$el.get(0)._flatpickr.setDate(value, true)
})
});
Here, you can pass in a changing selector and then the DD/MM/YYYY format as parameters. Hope this helps someone.
The control is a bunch of buttons, you can click them in Cypress, e.g
cy.get('button').contains('8').click(); // select the 8th day
The chevrons (left and right) you'll need to click a few times,
cy.get('button.uib-left').click().click().click().click() // keep going for MM/YY
You can click on that middle part, but I can't figure that one out exactly.
Ok, I figured it out, click "April 2021" once to choose the month
cy.get('button').contains('April 2021').click();
// now select the month
cy.get('button').contains('May').click()
OR click the "April 2021" then "2021" to select the year
cy.get('button').contains('April 2021').click();
cy.get('button').contains('2021').click();
cy.get('button.uib-left').click().click() // get decade with 1999
// now select the year
cy.get('button').contains('1999').click()
But you get the idea, interact the way a user does.

Cannot get the column specific timestamp to display on checkbox

I have set up a Google sheet for attendance of Employees on which clicking on the checkbox, the current time is recorded.
I cannot get the specific timestamp in the respective columns when the checkbox is ticked.
Clicking on a different checkbox also change the timestamp for previously checked checkboxes.
I have used this formula here : =If(B2 = TRUE,now(),"")
and used filter handle to apply the formula for other rows underneath.
I have used this formula: =If(B2 = TRUE,now(),"")
The sheet can be seen here: https://docs.google.com/spreadsheets/d/1p6jmnHXtCu2m7BdLfC-23A51MrwkJJJpXidpbsDwxfU/edit?usp=sharing
I want to record the current timestamp, for each row.
i.e on clicking of the checkbox the current time should be changed/recorded only for the column in the same row and not for other records.
this needs to be done with the script:
function onEdit(e) {
var s = SpreadsheetApp.getActiveSheet();
{
var r = s.getActiveCell();
if( r.getColumn() == 2 ) {
var nextCell = r.offset(0, 1);
var newDate = Utilities.formatDate(new Date(),
"GMT+1", "dd/MM/yyyy hh:mm:ss");
nextCell.setValue(newDate);
}
}
how to add a script to your spreadsheet
go to Tools
select Script editor
copy paste the script
save the project under some name
click on run icon and authorise it...
select your account
click on Advanced
select Go to * (unsafe)
click on Allow and return to your sheet (you can close script window/tab)

Basecamp API Calendar Event Dates

I am trying to create a calendar event for a project but the dates for the calendar event are not being properly set.
Here is the JSON data I am passing to the service
{
"summary":"New Calendar Item #2",
"description":"Details to follow",
"all_day":"false",
"starts_at":"2015-05-07T00:00:00.0000000",
"ends_at":"2015-05-12T00:00:00.0000000",
"remind_at":"2015-05-06T00:00:00.0000000",
"subscribers":"all",
"private":"false"
}
After I POST that information to the "new" Basecamp API the dates are not correct. Here are the dates that I receive back for the newly created Calendar Event:
"starts_at":"2015-05-06T20:00:00.000-04:00",
"ends_at":"2015-05-06T20:00:00.000-04:00",
"remind_at":"2015-05-05T20:00:00.000-04:00"
Not sure why the date values are off. I am assuming the dates are in proper format since I am not getting a 400 status code back.
Any help would be appreciated.
Here is a link to their documentation:
https://github.com/basecamp/bcx-api/blob/master/sections/calendar_events.md
Thanks!
If you change the format of the starts_at, ends_at and reminds_at to the following, you should get the times you expect:
"starts_at":"2015-05-07T00:00:00-00:00",
"ends_at":"2015-05-12T00:00:00-00:00",
"remind_at":"2015-05-06T00:00:00-00:00",
You could pass the timezone of the user instead if the event is to start at midnight local time:
"starts_at":"2015-05-07T00:00:00-04:00",
"ends_at":"2015-05-12T00:00:00-04:00",
"remind_at":"2015-05-06T00:00:00-04:00",

Editing Redmine calendar in dashboard

In Redmine's calendar, I would like to show all Tasks/Issues on which a currently logged in person in the account is a Member, Task Creator, Assignee, Reporter, or Watcher.
Now, from the following two arrays of helper.rb, I have created another array which merges issues_only and tasks_only. Then I wish to call that array in view part.
def issues_only
issues_all = issuesreportedbyme_items
issues_all.push *issueswatched_items
issues_all.push *issuesassignedtome_items
all = issues_all.reject{|v| v.tracker_id == 4}
rest = all.reject {|k| k.status_id == 5 }
rest.inject([]) { |result,h| result << h unless result.include?(h); result }
end
def tasks_only
tasks_all = issuesreportedbyme_items
tasks_all.push *issueswatched_items
tasks_all.push *issuesassignedtome_items
all = tasks_all.reject{|v|v.tracker_id == 5}
rest = all.reject {|k| k.status_id == 5 }
rest.inject([]) { |result,h| result << h unless result.include?(h); result }
end
Now, my question is what to include in view part in order to show the required calendar.
As you can see on this image the Calendar tab has filter options same as all other lists in Redmine. First you click on the filter switch icon (the little triangle on the image) and then you can add your filters to a report, list, gantt chart etc by selecting the filters from the filter selection combo box.
Your main problem will be that this filters don't have any logical operator feature. All the filters you select will be connected with the 'AND' operator so you can't define a list, gantt or report which corresponds to your 'OR' operator.
To get all the activities of all members of a specific project you only have to select the project and then unselect the "is : open" filter on the project calendar and click on "Apply Settings".
PS : This image is taken from our customized Redmine installation which has the Easyredmine plugin but the basics of filters are the same with Redmine.
Edit:
A way achieving your 'OR' requirement would be just selecting the filters which don't belong to your requirements and applying those filters. This way you would exclude those specific criteria that you want to apply the 'OR' statement to.
Don't forget to select the appropriate status filter in your filters. (Status is open/close/any/is not/is)

How can add new field to an event with dhtmlx scheduler?

I want to add new fields or propierties to an calendar event. How can I do it?
Thanks!
You need to
add new section to lightbox form
http://docs.dhtmlx.com/doku.php?id=dhtmlxscheduler:details_form
for new section of lightbox, set map_to value as name of new field
on server side add extra field to the list of fields in render command
This is how you would create a simple href link inside an event:
1) Go to the Event Configuration Console and create a custom field, under the section that says 'CUSTOM FIELD'. Give the field a name. In this example, call it 'url'. Select its type as 'TextArea'.
2) Create another custom field, call it 'link_title'.Also a 'TextArea'. Description is optional.
SAVE
3) Go to the 'Templates' section of the event console. Under the first section (... scheduler.templates.event_text=function(start,end,event){... ) where you can input text, put ->
return "<b> "+event.text+"</b><br><br>" + event.link_title + "";
SAVE
When you go to create your event from the main calendar, you will see extra fields. Type in them, save your event, and voila. Toot Sweet.
What do you mean by calendar event?
Is it adding a new event?, then it must be done using lightbox(built-in option)
scheduler.config.lightbox.sections=[
{ name:"description", height:50, map_to:"text", type:"textarea", focus:true },
{ name:"location", height:43, map_to:"event_location", type:"textarea",
default_value:"Blackheath Avenue London,Greenwich,Greater London SE10 8XJ,UK"},
{name:"recurring", height:115, type:"recurring", map_to:"rec_type",
button:"recurring"},
{ name:"time", height:72, type:"time", map_to:"auto"}
];
each tag used in here is suppoted by the plugin,,,,in you want to have a seperate customize lightbox go to
http://docs.dhtmlx.com/scheduler/custom_details_form.html
This is the preview

Resources