Guest User

Untitled

a guest
Feb 19th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.14 KB | None | 0 0
  1. ...Element MyElement is not clickable at point (x, y)... Other element would receive the click...
  2.  
  3. WebElement element = driver.findElement(By.id("id1"));
  4. Actions actions = new Actions(driver);
  5. actions.moveToElement(element).click().build().perform();
  6.  
  7. JavascriptExecutor jse1 = (JavascriptExecutor)driver;
  8. jse1.executeScript("scroll(250, 0)"); // if the element is on top.
  9. jse1.executeScript("scroll(0, 250)"); // if the element is at bottom.
  10.  
  11. WebElement myelement = driver.findElement(By.id("id1"));
  12. JavascriptExecutor jse2 = (JavascriptExecutor)driver;
  13. jse2.executeScript("arguments[0].scrollIntoView()", myelement);
  14.  
  15. WebDriverWait wait2 = new WebDriverWait(driver, 10);
  16. wait2.until(ExpectedConditions.elementToBeClickable(By.id("id1")));
  17.  
  18. driveme = new ChromeDriver();
  19. driver = new EventFiringWebDriver(driveme);
  20. ActivityCapture handle=new ActivityCapture();
  21. driver.register(handle);
  22.  
  23. @Override
  24. public void beforeClickOn(WebElement arg0, WebDriver event1) {
  25. try {
  26. System.out.println("After click "+arg0.toString());
  27. //System.out.println("Start afterClickOn - timestamp: System.currentTimeMillis(): " + System.currentTimeMillis());
  28. JavascriptExecutor executor = (JavascriptExecutor) event1;
  29. StringBuffer javaScript = new StringBuffer();
  30. javaScript.append("for (var c in Wicket.channelManager.channels) {");
  31. javaScript.append(" if (Wicket.channelManager.channels[c].busy) {");
  32. javaScript.append(" return true;");
  33. javaScript.append(" }");
  34. ;
  35. ;
  36. ;
  37. javaScript.append("}");
  38. javaScript.append("return false;");
  39. //Boolean result = (Boolean) executor.executeScript(javaScript.toString());
  40. WebDriverWait wait = new WebDriverWait(event1, 20);
  41. wait.until(new ExpectedCondition<Boolean>() {
  42. public Boolean apply(WebDriver driver) {
  43. return !(Boolean) executor.executeScript(javaScript.toString());
  44. }
  45. });
  46. //System.out.println("End afterClickOn - timestamp: System.currentTimeMillis(): " + System.currentTimeMillis());
  47. } catch (Exception ex) {
  48. //ex.printStackTrace();
  49. }
  50. }
Add Comment
Please, Sign In to add comment