Handle Calendar in Selenium WebDriver - Session - 16

Поділитися
Вставка
  • Опубліковано 19 лис 2024
  • Handle Calendar in Selenium WebDriver - Session - 16:
    Steps to handle calendar in Selenium Webdriver:
    1- Click on calendar
    2- Get all td of tables using findElements method
    3- using for loop get text of all elements
    4- using if else condition we will check specific date
    5- If date is matched then click and break the loop.
    6- Handle NoSuchElementException in case of (31st day)
    =================================================
    Learn How to for loop in Java:
    • Learn for and while Lo...
    ====================================================
    ****Subscribe to this channel, and press bell icon to get some interesting videos on Selenium and Automation:
    / naveenautomationlabs
    Follow me on my Facebook Page:
    / naveenqtpexpert
    ~-~~-~~~-~~-~
    Follow my Site/Blog: www.naveenautom...
    ========================================================
    Please watch: "Selenium & Automation Interview Preparation - By Naveen AutomationLabs"
    • Selenium & Automation ...
    ~-~~-~~~-~~-~ Subscribe to this channel, and press bell icon to get some interesting videos on Selenium and Automation:
    www.youtube.co...
    Follow me on my Facebook Page:
    / naveenqtpexpert
    Let's join our Automation community for some amazing knowledge sharing and group discussion on Telegram:
    t.me/joinchat/...
    Paid courses (Recorded) videos:
    Java & Selenium Course: www.naveenautom...
    API Course: www.naveenautom... ➡️Get Our Courses✔️
    📗 Get My Paid Courses at
    Paid courses (Recorded) videos:
    Java & Selenium Course: www.naveenautom...
    API Course: www.naveenautom...
    -------------------------------
    ✔️SOCIAL NETWORKS
    Facebook: / naveenqtpexpert
    Twitter: / naveenkhunteta
    Blog: www.naveenautom...
    --------------------------------
    Support My Channel✔️Or Buy Me A Coffee
    Paypal: paypal.me/nave...
    Google Pay: naveenanimation20@gmail.com
    --------------------------------
    ✔️Thanks for watching!
    देखने के लिए धन्यवाद
    Благодаря за гледането
    感谢您观看
    Merci d'avoir regardé
    Grazie per la visione
    Gracias por ver
    شكرا للمشاهدة

КОМЕНТАРІ • 86

  • @omkarpotdar2763
    @omkarpotdar2763 2 роки тому +3

    Thanks a lot Naveen for providing very good and easy solution for handling calendar. Really your videos are very useful in point of project work as well as interview purpose. Really appreciated your headwork.

  • @vithleshkumargupta
    @vithleshkumargupta 5 років тому +18

    Hi Naveen , There is one mistake so please put that in description -
    catch(NoSuchElementException e){
    System.out.println("Please enter the correct date value);
    flag=false; // Should be flag = true , Mistake here , It should be set to true to break outer loop
    break ;
    }
    Thanks for the amazing content.

  • @anshidance3279
    @anshidance3279 4 роки тому +2

    Thank you sir for your Explanation.The way you explaining i like it very much.I never seen this type of explanation

  • @raunakgupta3746
    @raunakgupta3746 4 роки тому +1

    Thank you @naveen for such amazing content, i have learned selenium through your youtube channel......Thank you once again.👍

  • @EliasHossein799
    @EliasHossein799 3 роки тому +2

    So Excellent tutorial !!! you are the super hero !!!

  • @Nitsng
    @Nitsng 6 років тому +2

    Thanks a lot for this video Naveen. if you don't mind, I have one suggestion . For videos like this, it will be good if you can show how it looks while debugging and how value of variables are changing, it would help in understanding. I appreciate your efforts from the bottom of my heart .

  • @sandeepkokane9549
    @sandeepkokane9549 3 роки тому +1

    Thanks Naveen. Very nice video on calender

  • @shakshisingh1001
    @shakshisingh1001 5 років тому +4

    Hi Naveen,
    Thanks for the Java and selenium videos. It's very helpful.
    Do you any c# tutorial video. Can you please share c# tutorial video link if you have.

  • @deepaknarang6190
    @deepaknarang6190 7 років тому +1

    Hi Naveen , very good explanation . i have one suggestion instead of flag you should use below code to break outerlook outerloop:
    for (int i=0; i < 5; i++) {
    for (int j=0; j < 5; j++) {
    if (i * j > 6) {
    System.out.println("Breaking");
    break outerloop;
    }
    System.out.println(i + " " + j);
    }
    }
    System.out.println("Done");

    • @naveenautomationlabs
      @naveenautomationlabs  7 років тому

      thanks for suggestion but I dint get you code. can u plz take the same calendar example and implement ur logic accordingly

  • @kirthinimal3062
    @kirthinimal3062 5 років тому +2

    Hi Naveen,
    This freecrm website is now been updated , im unable to click on the Calendar link , as i can see there no frame in there.
    i tired to inspect the same . but no luck.
    could you please help me on this.
    thanks

  • @aadiandadvikvlogs
    @aadiandadvikvlogs 4 роки тому

    Well explained Naveen as usual. Thank you so much. You are the best !!

  • @prakashvish3988
    @prakashvish3988 3 роки тому +1

    Very useful ❤️ thanks naveen ❤️

  • @manishaneharkar2009
    @manishaneharkar2009 3 роки тому +2

    Very Nicely explained, i am glad that i have seen your channel and going through it , but application which you are using ie CRM site seems changed a lot , so not able to simulate into practice... can you please provide alternate site for same.
    Thanks in advance.

    • @tejasb2104
      @tejasb2104 2 роки тому +1

      The site used above is changed to "classic.freecrm.com". It was a bit difficult to find out, but luckily got it. You might not be practising now, but can help others.

  • @usabI009
    @usabI009 6 років тому +1

    While using for loop method, you have worked with absolute xpath which might change. How to write customized xpath for selecting calendar dates as this one and then use for loop to select date ?

  • @WMohanty
    @WMohanty 4 роки тому +1

    The website where you gave the example has changed a lot. Could you please give another wesbsite to ptactice. Thanks

  • @sheikhkhurram1558
    @sheikhkhurram1558 6 років тому +4

    Hey , i did it in one line no need of two for loops . driver.findElement(By.xpath("//div[@id ='crmcalendar']//tr[2]//following-sibling::tr//td[contains (text() , '"+day+"')]")).click(); just pass the "day" value dynamically

    • @naveenautomationlabs
      @naveenautomationlabs  6 років тому

      Sheik Kurram using dynamic xpath following sibling I have explained in different video. This is for inywry point of view using for loop.

  • @ramakrishnants7826
    @ramakrishnants7826 4 роки тому +2

    Can you please suggest a different website as lot of changes have happened to freecrm.co.in?

  • @rajalakshmis201
    @rajalakshmis201 5 років тому +2

    Thank you Sir, clearly explained..

  • @mrpimpita5555
    @mrpimpita5555 6 років тому +2

    I have a problem in a calendar for example: Month of November the first at the beginning there are 29, 30, 31 and last row I also have 29, 30. As I do so I select November 30 but not October 30 since I am choosing October 30.

  • @samlawrence541
    @samlawrence541 6 років тому

    hi Naveen, thanks so much for all your unquantifiable effort in all your videos. please, Naveen, I was validating a site for broken links but it terminated abruptly giving a MalFunctionUrlException. and another one gave me a StaleElementException. please, how do I handle this. thank u.

  • @Siva-en9sw
    @Siva-en9sw 5 років тому +2

    Excellent boss thank you

  • @hydrasatya9565
    @hydrasatya9565 4 роки тому

    in this program if i want to select next date what i hav to do... should i use flag++????

  • @vikrantshingne8761
    @vikrantshingne8761 3 роки тому

    Thank you sir. I have a question is that We have to hard code
    that selected value ?

  • @JASSININETY
    @JASSININETY 5 років тому

    Naveen interviewer during selenium interview is asking if you are opening a website and it's opened as blank then how do you debug it.. Please suggest what should I answer them.

  • @mohammedmoinuddina2815
    @mohammedmoinuddina2815 6 років тому

    Hi Naveen, this is a great example for the date picker.. I used your concept and came up with the below simple solution by just having a stable xpath. Please review and provide your feedback:
    Thread.sleep(3000);
    driver.switchTo().frame("mainpanel");
    String date= "23-December-2019";
    String[] datearr = date.split("-");
    String curdate = datearr[0];
    String curmonth = datearr[1];
    String curyear = datearr[2];
    Select selmonth= new Select(driver.findElement(By.name("slctMonth")));
    selmonth.selectByVisibleText("December");
    Select selyear= new Select(driver.findElement(By.name("slctYear")));
    selyear.selectByVisibleText("2019");
    driver.findElement(By.xpath(".//*[@id='crmcalendar']//tbody//tr//td[contains(text(),'"+curdate+"')]")).click();
    System.out.println("Clicked");;
    Thread.sleep(3000);
    driver.quit();

  • @gopalsurse2071
    @gopalsurse2071 5 років тому

    Naveen please guide me for how to prepare machine test for software [Automation]testing profile [web application testing]

  • @LifeinSoBo
    @LifeinSoBo 4 роки тому +2

    Hey Naveen thanks once again for an another excellent video.
    Naveen , could you suggest some certification courses for Automation Architect ?

    • @naveenautomationlabs
      @naveenautomationlabs  4 роки тому

      Mail me at naveenanimation20@gmail.com

    • @reachtosky942
      @reachtosky942 Рік тому

      @@naveenautomationlabs may I connect with you now to get the idea?

  • @balakrishnan1274
    @balakrishnan1274 4 роки тому +1

    Hi Naveen , I have registered in freeCRM site i am not able to login to website which you mentioned in the video. Can you help is any website is there to test this cases. Here i am able to access the "ui.cogmento.com/home" page but here everything is different.

  • @rupeshgawande2716
    @rupeshgawande2716 6 років тому

    Hi Naveen I used this code in my framework. But how to set verification point for this?

  • @tapaskhandai
    @tapaskhandai 4 роки тому

    It is really helpful

  • @jdhung
    @jdhung 4 роки тому

    excellent video.

  • @manoharch1203
    @manoharch1203 6 років тому

    Hi Naveen, Please Make videos on Exception Handlings

  • @kimferko9038
    @kimferko9038 6 років тому

    Hi, does anybody know why why 'submit' Login button doesn't click on command: "driver.findElement(By.xpath("//*[@type= 'submit']")).click(); " Have tried also with Linktext and className. thank you. Nice videos!

  • @heenasamreen3191
    @heenasamreen3191 5 років тому

    Can you tell how to upload or download file using selenium or autoit?

  • @thiery572
    @thiery572 5 років тому +1

    Very interesting. Thanks!

  • @mayurmunshi2
    @mayurmunshi2 6 років тому

    Very nicely explained !!!!!!

  • @praveenautomationinterview2367
    @praveenautomationinterview2367 6 років тому

    Hi Naveen,
    same issue is here also it is not printing the all values of "dayVal" , and printing uptill the selected date.
    e.g.: if we selected '19-September-2017' then it is printed only upto 19 and rest are not printed.
    please guide in this.

    • @bharathkoneru4008
      @bharathkoneru4008 4 роки тому

      As you are breaking the inner loop on match & outer loop due to setting of flag value..
      values after 19 will not be printed

  • @manaligupta1098
    @manaligupta1098 7 років тому

    Great video. Thanks a lot

  • @niranjanniru5671
    @niranjanniru5671 4 роки тому

    As usual user the date format will be 01-July-2019
    How will you handle 01 date, as 1 will be present in the element

  • @sagarsapkota8023
    @sagarsapkota8023 7 років тому

    naveen its awesome.....

  • @reachtosky942
    @reachtosky942 Рік тому

    I wonder why we can't just use visible text ?

  • @akulabhaskar3797
    @akulabhaskar3797 6 років тому

    Thanks Naveen

  • @myfocus7447
    @myfocus7447 7 років тому +1

    did u shared video to handle web table which has dynamic values

    • @naveenautomationlabs
      @naveenautomationlabs  7 років тому +1

      +Jyoshna Manubolu here it is: ua-cam.com/video/Ue2DmBICOkE/v-deo.html

    • @myfocus7447
      @myfocus7447 7 років тому +1

      thanx it will be gud if u could explain us with getting dynamic row and column count as in real time we depend on this mostly

    • @sagarsapkota8023
      @sagarsapkota8023 7 років тому +1

      Jyoshna Manubolu dude check his youtube playlist how to become genius in xpath

  • @SunnyCool1110
    @SunnyCool1110 6 років тому

    Hi Naveen, I am unable to handle NoSuchElementException in console. Not printing the message

    • @kaulsandeep2318
      @kaulsandeep2318 6 років тому

      same problem here also I am unable to print the exception message " please enter the correct date"

    • @nalinaksheepanda1596
      @nalinaksheepanda1596 5 років тому

      I think, this is because, there are blank values available in those cell, which are printing in the console instead of the message.

  • @praveen420ify
    @praveen420ify 6 років тому

    As Firebug is not supported in Mozilla 55+ version then how can we take Absolute path here for reading calendar date?

    • @nikitagyanchandani97
      @nikitagyanchandani97 6 років тому

      You can use chroPath which is also an extension for chrome browser..just like firebug, firepath in mozilla firefox

    • @Nitsng
      @Nitsng 6 років тому

      Hi Nikita, Thanks for telling about Chropath, but in chrome, chropath is giving relative xpath and in firefox, absolute xpath. have you noticed that?

    • @srihari4827
      @srihari4827 5 років тому

      @@Nitsng we get both absolute and relative xpath using chropath

  • @xoda345
    @xoda345 6 років тому

    If i do not have firepath/firebug then I would not get the xpath in these format. So, how to automate in that case?

    • @raghuveermh6869
      @raghuveermh6869 6 років тому

      If you inspect the element, the element DOM structure will come in blue colour. Right clik on it, select copy--copy Xpath. it will give same xpath present in firepath

    • @xoda345
      @xoda345 6 років тому

      @@raghuveermh6869 but that's in Firefox..what about chrome?

    • @raghuveermh6869
      @raghuveermh6869 6 років тому

      In chrome also it will work, I am using same thing I don't have chropath and all. I am writing custom xpath, hardly I will use this method

  • @swethavarma631
    @swethavarma631 5 років тому

    Hi , It is not printing blank space instead throwing me an exception NoSuchElementFound

    • @shivam_methi
      @shivam_methi Рік тому

      have you found any solution for this?

  • @himanshusinghal7359
    @himanshusinghal7359 4 роки тому

    can you share this particular code

  • @priyavijayakumar1509
    @priyavijayakumar1509 6 років тому

    how to handle calendar in new event page in freecrm application

  • @purnachandrapatra2552
    @purnachandrapatra2552 7 років тому

    catch(NoSuchElementException e){System.out.println("please enter correct value");
    flag = true;
    break;
    i think we need to set the flag as true

    • @VijayKumar-nv9wy
      @VijayKumar-nv9wy 6 років тому

      Yes. I assume the same as by default false is set for flag variable.

    • @srihari4827
      @srihari4827 5 років тому

      Yes inside the catch block flag=true
      In order for the outer loop to break

  • @BhardwajFamily1
    @BhardwajFamily1 5 років тому

    Hi Naveen,Thanks for sharing this important video,I am not able to get that exception handling, I have written below code:WebDriver driver=new ChromeDriver();
    driver.manage().deleteAllCookies();
    driver.manage().window().maximize();
    driver.get("www.freecrm.com/");
    driver.manage().timeouts().pageLoadTimeout(20, TimeUnit.SECONDS);
    driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
    driver.findElement(By.name("username")).sendKeys("ajay_automation");
    driver.findElement(By.name("password")).sendKeys("ajay@2301");
    Thread.sleep(4000);
    driver.findElement(By.xpath("//input[@type='submit']")).click();
    Thread.sleep(4000);
    driver.switchTo().frame(1);
    String date= "31-November-2019";
    String newdate[]=date.split("-");
    String day= newdate[0];
    String month= newdate[1];
    String year= newdate[2];
    Thread.sleep(4000);

    Select select= new Select(driver.findElement(By.name("slctMonth")));
    select.selectByVisibleText(month);
    Select select1= new Select(driver.findElement(By.name("slctYear")));
    select1.selectByVisibleText(year);
    // //*[@id="crmcalendar"]/table/tbody/tr[2]/td/table/tbody/tr[2]/td[7]
    String before= "//*[@id=\"crmcalendar\"]/table/tbody/tr[2]/td/table/tbody/tr[";
    String after="]/td[";
    boolean flag=false;
    String newvale = null;
    final int totalnumberdays=7;
    for(int i=2;i

  • @myfocus7447
    @myfocus7447 7 років тому

    useful

  • @myfocus7447
    @myfocus7447 7 років тому

    if we can get dynamic row count no need of handling this no element found exception

    • @naveenautomationlabs
      @naveenautomationlabs  7 років тому

      +Jyoshna Manubolu correct but still it's good to handle nosuchelementexception. I have seen couple of cases where some hidden tr tags are there and selenium doesn't catch them. This is just to show how will u handle runtime exceptions.

    • @myfocus7447
      @myfocus7447 7 років тому

      ok ..thanx

  • @shivi9112
    @shivi9112 2 роки тому

    Can you please again provide ID and password for logiin page.

  • @arpitadas9542
    @arpitadas9542 5 років тому

    hi

  • @shreyanshjain2347
    @shreyanshjain2347 7 років тому

    at 41:20 when flag will be false then if(flag) will not be executed. this if block will only be executed only when flag is true.

    • @naveenautomationlabs
      @naveenautomationlabs  7 років тому

      Correct, because no need to execute outer for loop if expected value is found. Also if date is not appropriate after inner loop will be terminated. Check with all the boundary values and debug the code, you will have a clear picture.

    • @shreyanshjain2347
      @shreyanshjain2347 7 років тому +1

      Naveen AutomationLabs yes I know that u mentioned in the video that if flag is false then control will come to outer loop and will execute if loop and outer loop will break so I thought of commenting here because people will think like if flag is false then also if(flag) is executing.

    • @naveenautomationlabs
      @naveenautomationlabs  7 років тому

      Thanks @Shreyansh!

    • @amitbhardwaj1511
      @amitbhardwaj1511 6 років тому

      I am still confused with if statement🤔