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... - Наука та технологія
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
Thanks a ton Asish for following my channel for almost 5 years.. I am blessed to have such loyal people 🙏
"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.
Hi Monica I am glad you started attending interviews you are able to perform as well. Best of luck for coming interviews.
4 years back I learnt Frame by watching your video not refreshed again with different content. Thanks
Hey Swamy, sure I will make new video with new content for frames but concept is still same.
@@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
Amazing tutorials. Explained in very simplified way.
Thank u Sangeet 😁🙏
Thank you soo much Mukesh. Keep doing more videos . Your videos are helping me a lot.
Awesome work bro , Love it !
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.
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 ?
hi mukesh, pause method is showing as deprecated in my selenium so what i have to use instead of pause
Thank you!!!!
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.
Best of India 👌
Nice explanation sir..
Thanks and welcome Arfath
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👍😊
helpful bro
Thanks Ajay bro
Hey one quick question how to put Pause in dragAndDrop(,) ?
If we put dragAndDrop(,). pause () will it pause after each action?
dragAndDrop is just one method but as I mentioned in video after each method you can call pause method
@Mukesh, is Swapping is also possible in Actions class?
if is it like in UI then yes.. please show me example so that I can guide you.
Hi Mukesh, I have one another question of how we send the text without using the sendkeys() method.
Using JavaScriptExecutor
JavascriptExecutor jse = (JavascriptExecutor)driver;
jse.executeScript("arguments[0].value='hello';", driver.findElement(By.xpath("")));
thank you
Thanks Mukund
What is the difference between pause and thread sleep sir? - vinith
Hello,
is there any option to Drag xml file from my PC to web page.?
You can use sendKeys for file upload but it wont drag and drop but it can set the filepath.
Thank you soo much for explanation, can we perform dragAndDrop by particular element to position without using Actions class that is by using JavaScriptExecutor
Yes
@@Mukeshotwani Will you help me with some references...
nice
Thanks
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.
Select file then CTR+C and Select same package then use CTRL V
@@Mukeshotwani Ok same copy paste format...
But really more time saving with this awesome Trick which gets the results of HATTRICK......
@@Mukeshotwani Thanks a lot sir...... 👍
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);
}
What exception you are getting? Which url you are using?
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!!
Mukesh..plz post videos on Rest Assured BDD for get put post
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...
Hey Neeraj I dont have any video on this. Navin channel has this video.
@@Mukeshotwani thanks Mukesh
if you can show how to perform html 5 drag and drop then it would be helpful
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.
First method not working
What happened Anil? I mean what exception you are getting?