How To Perform Drag and Drop in Selenium WebDriver

Поділитися
Вставка
  • Опубліковано 21 кві 2020
  • In this video, I will explain to you all how to perform drag and drop in Selenium web driver using actions class.
    We have drag and drop method which will accept source and destinations and will perform the same.
    Links
    dhtmlx.com/docs/products/dhtm...
    jqueryui.com/draggable/
    www.selenium.dev/selenium/doc...
    • Selenium Webdriver Tut...
  • Наука та технологія

КОМЕНТАРІ • 57

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

    You are a great teacher brother, good bless you. I have been following you since 2015, you have grown leaps and bound, and content in your channel are also of very high quality now. Do keep up the good work

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

      Thanks a ton Asish for following my channel for almost 5 years.. I am blessed to have such loyal people 🙏

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

    "Drag and drop" was asked to me in an interview and thankfully I had watched your selenium-series and could answer it precisely.Thanks alot.

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

      Hi Monica I am glad you started attending interviews you are able to perform as well. Best of luck for coming interviews.

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

    4 years back I learnt Frame by watching your video not refreshed again with different content. Thanks

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

      Hey Swamy, sure I will make new video with new content for frames but concept is still same.

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

      @@Mukeshotwani Hi sorry for typo. I was thinking to type '""Now" refreshed again with different content. the concept is same but your new content is refreshing and helpful. sorry again

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

    Amazing tutorials. Explained in very simplified way.

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

    Thank you soo much Mukesh. Keep doing more videos . Your videos are helping me a lot.

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

    Awesome work bro , Love it !

  • @r.suganya9036
    @r.suganya9036 3 роки тому

    Hi Mukesh, Thanks for the video. I have a clarification. Do we need to consider left:113px for horizontal move offset and top :7px for vertical move offset?. Could you please confirm me?. For example when I drag and drop an element from source to target location it was displayed as top:170.5px and left:264px(here left:264px is fixed value i.e not changed). How to take values for X offset and Y offset. I have performed vertical movement not horizontal movement.

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

    I have tried in same which you did but I'm getting some error called .. detected upstream dialect:W3C.could anyone please assist on this ?

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

    hi mukesh, pause method is showing as deprecated in my selenium so what i have to use instead of pause

  • @user-br3jd4id2d
    @user-br3jd4id2d Рік тому

    Thank you!!!!

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

    Hi Mukesh, Your videos very informative. You could shown one example of performing signature in a particular box. That could have been a perfect example of drag and drop operation. I faced this situation in an application where I had to sign after filling all the fields of a form before hitting the submit button.

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

    Best of India 👌

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

    Nice explanation sir..

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

    Mukesh thanks for that. Can you also post some vedios on api automation. Btw I learnt selenium through your vedios only. They are very informative. Thanks👍😊

  • @Ajaybhanu303
    @Ajaybhanu303 2 місяці тому +1

    helpful bro

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

    Hey one quick question how to put Pause in dragAndDrop(,) ?
    If we put dragAndDrop(,). pause () will it pause after each action?

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

      dragAndDrop is just one method but as I mentioned in video after each method you can call pause method

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

    @Mukesh, is Swapping is also possible in Actions class?

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

      if is it like in UI then yes.. please show me example so that I can guide you.

  • @neerajyadav-wt4cn
    @neerajyadav-wt4cn 4 роки тому +2

    Hi Mukesh, I have one another question of how we send the text without using the sendkeys() method.

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

      Using JavaScriptExecutor
      JavascriptExecutor jse = (JavascriptExecutor)driver;
      jse.executeScript("arguments[0].value='hello';", driver.findElement(By.xpath("")));

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

    thank you

  • @info-3609
    @info-3609 3 роки тому

    What is the difference between pause and thread sleep sir? - vinith

  • @teamstark1018
    @teamstark1018 5 місяців тому +1

    Hello,
    is there any option to Drag xml file from my PC to web page.?

    • @Mukeshotwani
      @Mukeshotwani  5 місяців тому

      You can use sendKeys for file upload but it wont drag and drop but it can set the filepath.

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

    Thank you soo much for explanation, can we perform dragAndDrop by particular element to position without using Actions class that is by using JavaScriptExecutor

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

      Yes

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

      @@Mukeshotwani Will you help me with some references...

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

    nice

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

    Hi sir,
    Please Let me know the trick that how you are copying the entire class code and creating other Class in that package by changing it's name before pasting it.
    After going inside of that new class you are doing the changes.

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

      Select file then CTR+C and Select same package then use CTRL V

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

      @@Mukeshotwani Ok same copy paste format...
      But really more time saving with this awesome Trick which gets the results of HATTRICK......

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

      @@Mukeshotwani Thanks a lot sir...... 👍

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

    Hi Mukesh ,when I try to execute below code its not performing Drag and Drop on W3 schools.
    @Test
    public void scriptTest() throws InterruptedException
    {
    JavascriptExecutor js=(JavascriptExecutor)driver;
    js.executeScript("window.scrollBy(0,500)");
    WebElement src=driver.findElement(By.xpath("//*[@id='div1']/img"));
    System.out.println(src.getText());
    WebElement desc=driver.findElement(By.xpath("//*[@id='div2']"));
    Actions act=new Actions(driver);

    act.clickAndHold(src).moveToElement(desc).release().build().perform();
    Thread.sleep(3000);

    }

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

      What exception you are getting? Which url you are using?

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

      Hi Mukesh,
      After watching your Drag and Drop tutorial,trying to do Drag and Drop on W3schools.com
      URL :www.w3schools.com/html/html5_draganddrop.asp
      No Exception is coming ,test is passed (but there is no actions on the webpage.)
      Thanks a lot for your comments and help.
      You are very humble ..so nice of you!!

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

    Mukesh..plz post videos on Rest Assured BDD for get put post

  • @neerajyadav-wt4cn
    @neerajyadav-wt4cn 4 роки тому +1

    Hi Mukesh, could you upload the video for how we get the OTP and send to the text box and go for login my application. Kindly help as soon as possible...

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

      Hey Neeraj I dont have any video on this. Navin channel has this video.

    • @neerajyadav-wt4cn
      @neerajyadav-wt4cn 4 роки тому

      @@Mukeshotwani thanks Mukesh

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

    if you can show how to perform html 5 drag and drop then it would be helpful

  • @suzyeide3907
    @suzyeide3907 11 місяців тому

    Lesson learned -- I could not drag and drop into an EMPTY div. It just. won't. work. The drop location cannot be empty div. SOMETHING has to be there.

  • @AnilKumar-nq5lp
    @AnilKumar-nq5lp 4 роки тому +1

    First method not working

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

      What happened Anil? I mean what exception you are getting?