Web Automation Using Java & Selenium – Tutorial 15 – Capture Real Time [w/ subs]



00:00:00 – hello everyone welcome to this tutorial
00:00:02 – and this tutorial going to learn how to
00:00:04 – capture the time of our computer like
00:00:08 – this so in case you want to create a
00:00:13 – file and you want to link a file based
00:00:17 – on the time of the computer you can
00:00:19 – actually use this function and allows
00:00:21 – you to do that and this is a zero
00:00:26 – selenium it's actually pure Java so I'm
00:00:30 – just going to get rid of this we can use
00:00:32 – it in selenium which is probably i'm
00:00:34 – going to do in different tutorial but in
00:00:37 – this tutorial I'm just going to get rid
00:00:38 – of all the selenium stuff and let's just
00:00:41 – write pure Java so to start this
00:00:45 – function i'll write date format so we
00:00:49 – won't actually write the format of how
00:00:52 – we want the date to be like and then
00:00:54 – i'll write date state finally we can
00:01:00 – name this whatever you want ok and then
00:01:02 – equal new simple date format and make
00:01:08 – sure you write date nut data kids I kept
00:01:11 – writing that down wrong earlier for some
00:01:15 – reason so don't do the same mistakes I
00:01:17 – did and then you'll write the format and
00:01:20 – then i'll start with the month so this
00:01:23 – is the US so I'm just messed up with a
00:01:25 – month and make sure you actually write
00:01:26 – it in capital letters because if you
00:01:29 – read in a small letters it will actually
00:01:30 – think you're writing it for minutes not
00:01:35 – months and then day you can have it as
00:01:37 – smaller case that's fine and then year
00:01:41 – and i'm also going to write hour minute
00:01:45 – and second and then i'll define the date
00:01:54 – and suede date I just call it day less
00:02:00 – that's what I'm gonna call it and then
00:02:03 – equal knew that name and then you
00:02:09 – probably will have to import those so
00:02:12 – we do that so therefore you actually
00:02:15 – will see I'm me again you'll actually
00:02:18 – have to import this you'll have to
00:02:21 – import text and you will also have to
00:02:24 – import this okay and then i'll switch
00:02:30 – this to make it a string so i'll just
00:02:32 – call it date time equal to date file
00:02:39 – name which is right here and that format
00:02:43 – and and I want it to be I want this
00:02:49 – format to actually does as it for this
00:02:54 – for this right here and then then right
00:03:03 – time equal you can call this whatever
00:03:06 – you want as well time equal date in this
00:03:10 – court time to shrink and then I'll just
00:03:15 – have to define this drink over here so
00:03:18 – i'll write public or private doesn't
00:03:22 – really matter static strength the time
00:03:27 – and that's all I actually have to do so
00:03:31 – let's try it out I'm put a show you
00:03:33 – gather already confused right now but
00:03:36 – she give me two seconds I'll explain web
00:03:39 – does exactly and then I'll put print
00:03:43 – line and then I'll just put the time
00:03:50 – strength of half so if i print that out
00:03:52 – you actually get the time where the date
00:03:59 – that month I'm site and then the double
00:04:02 – bottom the day a year and then the time
00:04:06 – and then the minute and then the second
00:04:11 – so if you look I have a file name you
00:04:13 – can write so you're taking a screenshot
00:04:16 – of something so you can take a
00:04:17 – screenshot and then he put this day so
00:04:20 – if you want to go back to your log and
00:04:23 – you want
00:04:24 – the exact thing of what happen this
00:04:26 – happen it will actually capture it like
00:04:28 – that so and if I like I can actually get
00:04:31 – rid of this whole thing and if I run it
00:04:33 – it will so do the same job like that so
00:04:37 – you don't actually have to do the whole
00:04:38 – format they're just multiple options
00:04:40 – that you can do and that's all for this
00:04:44 – tutorial actually pretty simple and
00:04:45 – straightforward there's pure java and
00:04:48 – i'll show you again how we get can use
00:04:51 – it in later tutorials i hope you enjoyed
00:04:53 – this video and have a great day thank
00:04:57 – you


Video Url:
http://youtu.be/edkae0lsUFs

Comments

comments