Protractor dragAndDrop not working - selenium

I have tried all possible ways for drag and dropping the elements available in the below link,
https://the-internet.herokuapp.com/drag_and_drop
But i am unable to achieve drag and drop the elements between two boxes.
Methods i tried so for
1.browser.actions().mouseMove(a).mouseDown().mouseMove(b).mouseUp().perform()
2.browser.actions().dragAndDrop(a,b).perform()
3.browser.driver.actions().dragAndDrop(a,{x:1000,y:0}).perform();
All the above methods are not working. Can some one figure out the possible work around for achieve dragAndDrop function on the elements.
Thanks in advance!!

Related

Creating toggle function for multiple elements in React Native

I created two dropdown lists by creating two separate functions. But it makes my code too clumsy, especially if I will add more lists on the screen. Here is my code:
https://snack.expo.dev/bhceYoSTC
Can someone help me to combine my functions to one which after clicking will open lists and change icons separately , but not two lists at one time?
Thank you in advance
Check this out, https://snack.expo.dev/3fvb0OERM
Hope this work for you now.

Unable to select drop down button for python selenium

How would I select this button
and click on it?
I have tried several methods and none of them have clicked it.
try with css selector and javaScript executor for select multi-class element and click it
driver.execute_script("document.querySelector('button.btn-select.nowrap-line')[0].click()")
Have you tried the class_name selector?
element = driver.find_element_by_class_name("btn-select nowrap-line")
I know you said you've tried several methods, maybe list the different ways and I can probably try to see why it's failing

Webdriver.IO dragAndDrop does not correctly

I am trying to drag and drop element by using webdriver.io dragAndDrop function (and tried with moveToObject, buttonDown, up ... etc) and it's able to press the element but releasing it in random places, usually to the right bottom corner of the screen, not sure why that's happening. For selector I am using xpath.
I have tried also this way and still does not work.
browser.moveToObject('//div[2]');
browser.buttonDown();
browser.moveToObject('//div[3]');
browser.buttonUp();

How to remove this border from tooltipdialog that shows up on mouse click?

Whenever I click inside a tooltipdialog, this border shows up around it.
Is there an easy way to remove this?
EDIT: After trying in different browsers, it seems to affect only Chrome, the outline doesn't appear in Firefox or IE.
I faces the similar issue when i started working on Dojo. To fix this basically you need to add the following css for dijit's dijitTooltipDialog class
.dijitTooltipDialog {
outline : none
}
See this for example.

SVG and selenium

Hej Guys
I an using google visualization api to draw stacked bar chart. Its all fine but now i want to test it with selenium but having a hard time finding the elements in the google chart.
For example i want to click on the chart element but everytime i try to find an element by xpath i get exception "OpenQA.Selenium.NoSuchElementException: The element could not be found"
I read that with selenium its tricky to click on the svg images.
Is there anybody who know a solution cuz i m kind of desprate and i havent find a suitable solution on the net by myself.
My chart looks like this:
http://i48.tinypic.com/21o4swx.png
What i am trying todo is:
webdriver.Navigate().GoToUrl("http://localhost:59777/Tests/TestsMainView");
IWebElement element = webdriver.FindElement(By.XPath("/html/body/div/div[2]/div[2]/iframe/html/body/div/svg/g[2]/g/g[2]/rect[5]"));
Actions myAction = new Actions(webdriver);
myAction.Click(element).Perform();
Thread.Sleep(9999);
Thanks :)
Here is some advice that may help you. First your second line of code is should be
WebElement element = webdriver.FindElement(By.xpath("//img[contains(#src,'http://i48.tinypic.com/21o4swx.png')]"))
You had "IWebElement" (this was probably just a typo in your question). I changed the way the element is found searching for matching element instead of starting at the top level and working down. This is a better practice to narrow down the element you are attempting to interact with so that changes to the code don't instantly break your test. Also unless you start an xpath expression off with "//" or "xpath=" selenium Webdriver will not recognize it so even if your path never changed selenium Webdriver wouldn't be able to find it.
If I understand what you are trying to do then you can also remove lines 3-5 and replace them with the following,
element.click();
This will have selenium Webdriver zoom in on the chart provided by your link. I hope this helps
I noticed xpath cannot select anything within an svg tag. I managed to find elements using className or tagName selectors instead or you could even try cssSelectors but I am not sure about that one. Note that you can still use xpath to access parents of a node inside an svg using:
By.xpath("..");
Hope that will help.