Select depart date, 5 days from today and return date, 6 days from today in Selenium“Best before”...

I am confused as to how the inverse of a certain function is found.

Employee lack of ownership

Pauli exclusion principle

What are substitutions for coconut in curry?

How do I change two letters closest to a string and one letter immediately after a string using Notepad++?

Did Ender ever learn that he killed Stilson and/or Bonzo?

Are ETF trackers fundamentally better than individual stocks?

Professor being mistaken for a grad student

Why Choose Less Effective Armour Types?

Min function accepting varying number of arguments in C++17

How to terminate ping <dest> &

Is "upgrade" the right word to use in this context?

Tikz diagrams and node placements

What is "focus distance lower/upper" and how is it different from depth of field?

How do I parse a string to number while destructuring?

et qui - how do you really understand that kind of phraseology?

How to use deus ex machina safely?

Can a druid choose the size of its wild shape beast?

how to draw this figure in latex

Time travel from stationary position?

New passport but visa is in old (lost) passport

Brexit - No Deal Rejection

Why did it take so long to abandon sail after steamships were demonstrated?

Unexpected result from ArcLength



Select depart date, 5 days from today and return date, 6 days from today in Selenium


“Best before” puzzleSelecting the number of working days minus weekend days and UK bank holidaysDate Format providerCalculate future date based on business daysAccess function to return “number of working days until date” for formListing every date between two dates in input fieldsSimple Input Text AnalysisGiven a date and a duration, calculate the future dateAutomate booking on a travel sitePython date formatter













1












$begingroup$


I am automating a scenario of flight booking on Cleartrip.com(https://www.cleartrip.com/flights) in which I have to enter depart date, 5 days from today and return date, 6 days from today. I have written below code.



Date dt = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(dt);
calendar.add(Calendar.DATE, 5);
dt = calendar.getTime();
String departdate = new SimpleDateFormat("dd/mm/yyyy").format(dt);

//enter Journy date in the field
WebElement depart = driver.findElement(By.id("DepartDate"));
depart.sendKeys(departdate);

Date dt1 = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(dt1);
calendar.add(Calendar.DATE, 6);
dt1 = calendar.getTime();
String returndate = new SimpleDateFormat("dd/mm/yyyy").format(dt1);

//enter returndate in the field
WebElement return= driver.findElement(By.id("ReturnDate"));
return.sendKeys(returndate);









share|improve this question









New contributor




Sh87 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$

















    1












    $begingroup$


    I am automating a scenario of flight booking on Cleartrip.com(https://www.cleartrip.com/flights) in which I have to enter depart date, 5 days from today and return date, 6 days from today. I have written below code.



    Date dt = new Date();
    Calendar calendar = Calendar.getInstance();
    calendar.setTime(dt);
    calendar.add(Calendar.DATE, 5);
    dt = calendar.getTime();
    String departdate = new SimpleDateFormat("dd/mm/yyyy").format(dt);

    //enter Journy date in the field
    WebElement depart = driver.findElement(By.id("DepartDate"));
    depart.sendKeys(departdate);

    Date dt1 = new Date();
    Calendar calendar = Calendar.getInstance();
    calendar.setTime(dt1);
    calendar.add(Calendar.DATE, 6);
    dt1 = calendar.getTime();
    String returndate = new SimpleDateFormat("dd/mm/yyyy").format(dt1);

    //enter returndate in the field
    WebElement return= driver.findElement(By.id("ReturnDate"));
    return.sendKeys(returndate);









    share|improve this question









    New contributor




    Sh87 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.







    $endgroup$















      1












      1








      1





      $begingroup$


      I am automating a scenario of flight booking on Cleartrip.com(https://www.cleartrip.com/flights) in which I have to enter depart date, 5 days from today and return date, 6 days from today. I have written below code.



      Date dt = new Date();
      Calendar calendar = Calendar.getInstance();
      calendar.setTime(dt);
      calendar.add(Calendar.DATE, 5);
      dt = calendar.getTime();
      String departdate = new SimpleDateFormat("dd/mm/yyyy").format(dt);

      //enter Journy date in the field
      WebElement depart = driver.findElement(By.id("DepartDate"));
      depart.sendKeys(departdate);

      Date dt1 = new Date();
      Calendar calendar = Calendar.getInstance();
      calendar.setTime(dt1);
      calendar.add(Calendar.DATE, 6);
      dt1 = calendar.getTime();
      String returndate = new SimpleDateFormat("dd/mm/yyyy").format(dt1);

      //enter returndate in the field
      WebElement return= driver.findElement(By.id("ReturnDate"));
      return.sendKeys(returndate);









      share|improve this question









      New contributor




      Sh87 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.







      $endgroup$




      I am automating a scenario of flight booking on Cleartrip.com(https://www.cleartrip.com/flights) in which I have to enter depart date, 5 days from today and return date, 6 days from today. I have written below code.



      Date dt = new Date();
      Calendar calendar = Calendar.getInstance();
      calendar.setTime(dt);
      calendar.add(Calendar.DATE, 5);
      dt = calendar.getTime();
      String departdate = new SimpleDateFormat("dd/mm/yyyy").format(dt);

      //enter Journy date in the field
      WebElement depart = driver.findElement(By.id("DepartDate"));
      depart.sendKeys(departdate);

      Date dt1 = new Date();
      Calendar calendar = Calendar.getInstance();
      calendar.setTime(dt1);
      calendar.add(Calendar.DATE, 6);
      dt1 = calendar.getTime();
      String returndate = new SimpleDateFormat("dd/mm/yyyy").format(dt1);

      //enter returndate in the field
      WebElement return= driver.findElement(By.id("ReturnDate"));
      return.sendKeys(returndate);






      java datetime selenium






      share|improve this question









      New contributor




      Sh87 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      Sh87 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited yesterday









      200_success

      130k17153419




      130k17153419






      New contributor




      Sh87 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 2 days ago









      Sh87Sh87

      132




      132




      New contributor




      Sh87 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Sh87 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Sh87 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          1 Answer
          1






          active

          oldest

          votes


















          0












          $begingroup$

          You don't need the Date type. You can do it all with a Calendar instance and a DateFormat instance:



              DateFormat dateFormat = new SimpleDateFormat("dd/mm/yyyy");
          Calendar now = Calendar.getInstance(); // gets current date
          now.add(Calendar.DATE, 5); // add five days
          String firstDate = dateFormat.format(now.getTime());
          ...
          now.add(Calendar.DATE, 1); // add one more day
          String secondDate = dateFormat.format(now.getTime());





          share|improve this answer









          $endgroup$













            Your Answer





            StackExchange.ifUsing("editor", function () {
            return StackExchange.using("mathjaxEditing", function () {
            StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
            StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
            });
            });
            }, "mathjax-editing");

            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "196"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });






            Sh87 is a new contributor. Be nice, and check out our Code of Conduct.










            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f215437%2fselect-depart-date-5-days-from-today-and-return-date-6-days-from-today-in-sele%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0












            $begingroup$

            You don't need the Date type. You can do it all with a Calendar instance and a DateFormat instance:



                DateFormat dateFormat = new SimpleDateFormat("dd/mm/yyyy");
            Calendar now = Calendar.getInstance(); // gets current date
            now.add(Calendar.DATE, 5); // add five days
            String firstDate = dateFormat.format(now.getTime());
            ...
            now.add(Calendar.DATE, 1); // add one more day
            String secondDate = dateFormat.format(now.getTime());





            share|improve this answer









            $endgroup$


















              0












              $begingroup$

              You don't need the Date type. You can do it all with a Calendar instance and a DateFormat instance:



                  DateFormat dateFormat = new SimpleDateFormat("dd/mm/yyyy");
              Calendar now = Calendar.getInstance(); // gets current date
              now.add(Calendar.DATE, 5); // add five days
              String firstDate = dateFormat.format(now.getTime());
              ...
              now.add(Calendar.DATE, 1); // add one more day
              String secondDate = dateFormat.format(now.getTime());





              share|improve this answer









              $endgroup$
















                0












                0








                0





                $begingroup$

                You don't need the Date type. You can do it all with a Calendar instance and a DateFormat instance:



                    DateFormat dateFormat = new SimpleDateFormat("dd/mm/yyyy");
                Calendar now = Calendar.getInstance(); // gets current date
                now.add(Calendar.DATE, 5); // add five days
                String firstDate = dateFormat.format(now.getTime());
                ...
                now.add(Calendar.DATE, 1); // add one more day
                String secondDate = dateFormat.format(now.getTime());





                share|improve this answer









                $endgroup$



                You don't need the Date type. You can do it all with a Calendar instance and a DateFormat instance:



                    DateFormat dateFormat = new SimpleDateFormat("dd/mm/yyyy");
                Calendar now = Calendar.getInstance(); // gets current date
                now.add(Calendar.DATE, 5); // add five days
                String firstDate = dateFormat.format(now.getTime());
                ...
                now.add(Calendar.DATE, 1); // add one more day
                String secondDate = dateFormat.format(now.getTime());






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered yesterday









                Bill HilemanBill Hileman

                1566




                1566






















                    Sh87 is a new contributor. Be nice, and check out our Code of Conduct.










                    draft saved

                    draft discarded


















                    Sh87 is a new contributor. Be nice, and check out our Code of Conduct.













                    Sh87 is a new contributor. Be nice, and check out our Code of Conduct.












                    Sh87 is a new contributor. Be nice, and check out our Code of Conduct.
















                    Thanks for contributing an answer to Code Review Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    Use MathJax to format equations. MathJax reference.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f215437%2fselect-depart-date-5-days-from-today-and-return-date-6-days-from-today-in-sele%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Fairchild Swearingen Metro Inhaltsverzeichnis Geschichte | Innenausstattung | Nutzung | Zwischenfälle...

                    Pilgersdorf Inhaltsverzeichnis Geografie | Geschichte | Bevölkerungsentwicklung | Politik | Kultur...

                    Marineschifffahrtleitung Inhaltsverzeichnis Geschichte | Heutige Organisation der NATO | Nationale und...