babu
babu

Reputation: 31

Selenium webdriver - script is not worked with chrome but it is worked with firefox

This code is working with firefox but not working with chrome. Without change any thing it is working fine in firefox. I have used implicit and explicit nothing is working with chrome. Is anything i want to check with environment

WebDriverWait wait1 = new WebDriverWait(browser, 15);
wait1.until(ExpectedConditions.elementToBeClickable((By.cssSelector("input[name='ctl00$cphMainContent$imgAdd']"))));

//  browser.findElement(By.id("cphMainContent_imgAdd")).click();
browser.findElement(By.cssSelector("input[name='ctl00$cphMainContent$imgAdd']")).click();
WebDriverWait wait = new WebDriverWait(browser, 15);
wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector("span[id='tab3']")));

error message -

unknown error: Element is not clickable at point (332, 548). Other element would receive the click:

...

(Session info: chrome=42.0.2311.152) (Driver info: chromedriver=2.15.322448 (52179c1b310fec1797c81ea9a20326839860b7d3),platform=Windows NT 6.1 SP1 x86) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 39 milliseconds

Upvotes: 2

Views: 2004

Answers (1)

vvvvaib
vvvvaib

Reputation: 334

Could be possibly one of these reasons -

  1. Object not loaded completely and click is performed
  2. Chrome window is not maximized and chromedriver could not locate the element correctly.

Possible Solutions -

  1. Increase sleep timer using Thread.sleep(40000); - Try this for debugging to the root cause of the issue
  2. Maximize the chrome window - driver.manage().window().maximize();
  3. Try to use javascriptexecutor for scrolling to the object and then click

Upvotes: 1

Related Questions