Appium Cannot get the element as the element ID will vary from time to time - appium

I am using Appium to scrapy some data from an app,
the element xpath is android.view.View[#content-desc="25"]
but what i want to get is the value "25".
For example, the time its shows is 11:25
in Appium , it shows me that
el1 = driver.find_element(by=AppiumBy.ACCESSIBILITY_ID, value="25")
However i cannot find this element as it varies from time to time .

Related

How to limit minimum possible date/time in jtsage datetimebox?

anybody knows or has an example of how to set limitation of minimum allowed datetime in the datetimebox in jtsage script?
My case is the following - I have a form where user enters tennis game, and there are two date/time related fields: GameStart and GameEnd.
Once the user sets GameStart (which can be any time in the future), for example 2018-02-25 13:00, I would like to limit the GameEnd minimum to the same date/time as the user has selected as GameStart. In this particular example user should not be able to set datetime lower than 2018-02-25 13:00.
To put it in other words, user cannot select GameEnd before GameStart. Makes sense, right?
I have a callback JavaScript function, which triggers just fine, reads the GameStart ad datetime object. But once I set min and applyMinMax, it just doesn't work.
This is my code:
var minDate = $('#GameStarts').datebox('getTheDate');
$('#GameEnds').attr('min', minDate);
$('#GameEnds').datebox('applyMinMax');
Any idea?

How to show "33 minutes ago" on Grafana dashboard with InfluxDB?

I have recently set up Grafana with InfluxDB. I'd like to show a panel that indicates how long it has been since an event took place.
Examples:
Server last reported in: 33 minutes ago
Last user sign up: 17 minutes ago
I can get a single metric pretty easily with the following code:
SELECT time, last("duration") as last_duration FROM custom_events ORDER BY time DESC
But I can't seem to get Grafana to do what I want with the time field.
Any suggestions?
Since Grafana(4.6.0) this is now possible with singlestat panels.
GoTo the Options-Tab
Select Value -> Stat -> Time of last point
Select Value -> Stat -> Unit -> Date & time -> From Now
Its currently(4.0.3) not possible to show the last timestamp in singlestat panels. But there is an issue for supporting this. Hopefully we will find time to implement this in the future.
In 8.4.0 There is a unit selection that allows you to do this, make sure your timestamp is in milliseconds since the epoch and select From Now as the unit in the dropdown menu
singlestat pannel expressing time since

How to calculate flight duration from given datetime and timezone?

i have problems getting the right time difference for a given route and a departing and arrival time plus the timezones.
My route is Vienna to Washington D.C. Departing time from Vienna is 10.09.2014 10:25 (vienna time) and arrival time is 10.09.2014 14:20 (washington time)
The timezone for both are Europe/Vienna and US/Eastern.
I use momentjs + momentjs/timezone to get the right values. But momentjs is returning the wrong value in minutes.
The correct value should be 595 Minutes makes 9h 55m.
This is the line i tried:
moment( '10.09.2014 1420', 'DD.MM.YYYY HHmm').tz( 'US/Eastern').diff( moment( '10.09.2014 1025', 'DD.MM.YYYY HHmm').tz( 'Europe/Vienna'), 'minutes');
I tried even with moment.tz( date, format, timezone).diff( ...) but this returns 235 too.
Why it returns 235 ?
You can easily test this on the momentjs.com/timezone site by using the console in your webdev toolbar.
What am i doing wrong here? Both times i have are always local airport time, and i want the time difference in minutes.
Just to close this question.
The timezone data was missing. Be careful when using and building momentjs. Check that you are building including timezone data.
In my case i had to use a specific set of languages too. So i had a custom grunt call in order to build.
Now it works.

grails ORM , how to search Date without time

I am using postrges db.
My domain has a date field:
java.util.Date requestedDate;
I am trying to search by date in my controller:
eq ("requestedDate", requestedDate)
This works fine, but the problem is that date and time has to be exactly matching for this. But in application the user will only enter the date to search items (like give me all requests which are made on 2014-02-05 and the browser application will add the current time to the request). So the comparison fails because the user entered time is different from the time during creation of the request.
I tried 'like' but it throws error.
How to compare only date part ?
You could do something like this:
Date now = new Date()
now.clearTime()
def results = Meeting.withCriteria {
between('date', now, now+1)
}
So this strips off the time portion of the current date, and then does a 'between' query (between midnight just gone and midnight 24 hours later).
Still it looks like there is no convenient way to realize this.
You need a small detour by computing the start of the day and the end of the day and use the between operator.
EDIT
I just saw now rcgeorge23 gave you the right example for doing this.

Regional setting confusion regarding date format from PostgreSQL

I'm working on an application that requires the following regional settings (Delphi 7 and PostgreSQL 9.0):
1. DateSeparator:='/';
2. TimeSeparator:=':';
3. ThousandSeparator:=',';
4. DecimalSeparator:='.';
5. ShortDateFormat:='MM/dd/yy';
6. ShortTimeFormat:='hh:mm:ss';
I need to change the regional setting only for my application and not system wide.
In OnCreate of the form I set the above separators, and
my current system separators are:
1. DateSeparator='|';
2. TimeSeparator='|';
3. ThousandSeparator='|';
4. DecimalSeparator='|';
(This is for the test purpose.)
Now in Postgres I have a table from where I get dates to display in my application but somehow the dateseparator doesn't seem to work (as seen in label1)!
Check the image.
I fire a query to get the dates from the table
Label1.Caption:=(Fields(1).Text);
Label2.Caption:=datetostr(Fields(1).Data) ;
The query is
select min(dat), max(dat) from diary where survey in (2008401) and event not in ('E','C','R') and region=6100;
now the same date if I take as .data differ in the date separator from .text dateseparator
why this is happening?
Why are the regional settings not applied to label1.caption (as shown in the image)?
DateToStr uses ShortDateFormat as the output format. You didn't change that from the MM/dd/yy set initially; you only changed the DateSeparator.
I'm confused though, about why you'd want to use (Fields(1).Text) (is that right? Parentheses instead of [] for the Fields subscript?).
If the DB is configured to use | as the date separator, as it appears it is from your screen image, why are you using DateToStr? It appears that .Text is getting the information in the format you're looking to obtain.
ok i found on one site
enter link description here
for getting the appropriate format all i had to do was get the fire the query as
select to_char(min(dat),'mm/dd/yy'), to_char(min(dat),'mm/dd/yy')
from diary
where survey in (2008401) and
event not in ('E','C','R') and region=6100;
This gave me the proper result in the format i wanted

Resources