Selenium WebDriver JAVA: How to click at x,y coordinates?

I am not able to click a Point in Flash Player, I have a Flash Iframe Embedded in browser , and I want to click on certain Button, Since its tough for me to code for Flash and communicate with Flash Elements.

So, i want to click (1170,230) , assuming 0,0 is top left corner of browser Page(Excluding Address and bookmark Bar)

I am using follwing code , However it is not working.

WebDriverWait wait = new WebDriverWait(driver, 15);

WebElement knownElement1=wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//*@id='game']")));

Actions builder1 = new Actions(driver); 
builder1.moveToElement(knownElement1, 1170, 230).click().perform();

Answers


Did you switch to this flash frame?

driver.switchTo().frame(frameWebElementInstance);

Don't forget to switch back, if you'll be doing sth outside of the frame


Try this:-

int xScrollPosition= 0; //enter your x co-ordinate
int yScrollPosition= 0; //enter your y co-ordinate

JavascriptExecutor executor = (JavascriptExecutor) driver;
executor.executeScript("window.scroll(" + xScrollPosition + ", " + yScrollPosition + ");");
executor.executeScript("arguments[0].click();", element);

Hope it will help you :)


Need Your Help

Display some part of plot in canvas and scroll through rest of plot

javascript html5 canvas html5-canvas

I am trying to create a plot which is larger than canvas size. So is there a way I can create the plot and show only part of it in the canvas viewing area.

Go fmt float64 issue

go gofmt

I've come across a bit of a gotcha in my noob understanding of go fmt package