Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

selenium can't drag Canvas elements #9581

Closed
YinChunGuang opened this issue Jun 16, 2021 · 11 comments
Closed

selenium can't drag Canvas elements #9581

YinChunGuang opened this issue Jun 16, 2021 · 11 comments
Labels
G-w3c Requires change to W3C Spec

Comments

@YinChunGuang
Copy link

🐛 Bug Report

There are abnormalities in the functions such as click, double-click, drag and drop of Canvas used by Selenium to automate testing.
The specific reason is that Selenium cannot get the elements inside Canvas.

To Reproduce

Exercising a page's dragging and dropping functionailty used to be simple with
Seleniums's Action Builder, but sadly ,it won't work with HTML5 drag and drop .

We use the selenium function 'Actions.dragAndDrop(source,target)' to control the elements inside canvas,it dosen't work that way for selenium can't select the element .

Expected behavior

selenium can drap canvas elements

Test script or set of commands reproducing this issue

Actions actions = new Action(driver);
actions.dragAndDrop(source,target);

The code dosen't work ,also no exception.

Environment

OS: Windows 10
Browser: Chrome
Browser version: 90.0.4430.24
Browser Driver version: 90.0.4430.24
Language Bindings version: Java 8 c

@ghost ghost added the needs-triaging label Jun 16, 2021
@diemol

This comment has been minimized.

@diemol diemol closed this as completed Jun 16, 2021
@diemol
Copy link
Member

diemol commented Jun 16, 2021

Apologies, I wrote my reply in the wrong issue, reopening.

@diemol diemol reopened this Jun 16, 2021
@diemol
Copy link
Member

diemol commented Jun 16, 2021

@YinChunGuang, could you please provide a concise reproducible test case, that includes the page required to execute the scenario (a sample page or a public site).

@YinChunGuang
Copy link
Author

test case :

@diemol

public class BaseModel {

    public static ChromeDriver driver;

    public static void main(String[] args) {
        initChromeDriver();
        driver.get("http://localhost:9528");
        WebElement source = driver.findElementByXPath("//*[@id=\"nodes\"]/li[1]");
        WebElement target = driver.findElementByXPath("//*[@id=\"canvas_1\"]");
        Actions actions = new Actions(driver);
        actions.dragAndDrop(source,target);

        driver.quit();
    }

    private static void initChromeDriver() {
        **System.setProperty("webdriver.chrome.driver", "D:\\java\\chromedriver.exe");**
        ChromeOptions options = new ChromeOptions();
        driver = new ChromeDriver(options);
        driver.manage().timeouts().implicitlyWait(10000, TimeUnit.MILLISECONDS);
        driver.manage().window().maximize();
    }
}

please set chrome driver for the test !

@diemol
Copy link
Member

diemol commented Jun 17, 2021

What is running in driver.get("http://localhost:9528");? We need to have access to the page.
What Selenium version are you using?

@YinChunGuang
Copy link
Author

YinChunGuang commented Jun 17, 2021

@diemol
Copy link
Member

diemol commented Jun 17, 2021

Could you please add instructions, either here or at the README showing how to setup and execute everything?

@YinChunGuang
Copy link
Author

YinChunGuang commented Jun 19, 2021

#1 cd /selenium_test/vue_example
#2 npm i
#3 npm run dev
#4 open project "selenium_test\seleniumtest"
#5 update chromeDriverPath : BaseModel.DRIVER_PATH
#6 start "BaseModel.main()"

result selenium can't drag the element

@diemol

@AutomatedTester AutomatedTester added D-IE G-w3c Requires change to W3C Spec and removed R-awaiting answer D-IE labels Jul 1, 2021
@AutomatedTester
Copy link
Member

I think this might be another version of w3c/webdriver#1488 since it's dragging an element from outside the canvas into the canvas.

@AutomatedTester
Copy link
Member

Duplicate of #8345

@AutomatedTester AutomatedTester marked this as a duplicate of #8345 Jul 16, 2021
@github-actions
Copy link

github-actions bot commented Sep 5, 2021

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Sep 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
G-w3c Requires change to W3C Spec
Projects
None yet
Development

No branches or pull requests

3 participants