Unable to click a object using chromeDriver | Selenium Forum
M
Posted on 30/07/2016
Sir, [b:dz94uemy]NOTE:[Can click the same element usingFireFoXDriver][/b:dz94uemy]

[b:dz94uemy]To Do:[/b:dz94uemy]i Need to click a link in chrome browser...


[b:dz94uemy]Issue :Element is never clicked in chrome browser

Stack Trace:Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: Element is not clickable at point (186, 611). Other element would receive the click: <a href="SonSo.pdf" id="CSR_U_1" title="sonso.pdf">...</a>
(Session info: chrome=51.0.2704.103)
(Driver info: chromedriver=2.22.397933 (1cab651507b88dec79b2b2a22d1943c01833cc1b),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 129 milliseconds
Build info: version: '2.47.1', revision: '411b314', time: '2015-07-30 02:56:46'
System info: host: 'LWS601898', ip: '10.167.56.999', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_79'
Session ID: 8b111f1610dc40390218dc50eeee3419
Driver info: org.openqa.selenium.chrome.ChromeDriver[/b:dz94uemy]
Capabilities [{platform=XP, acceptSslCerts=true, javascriptEnabled=true, browserName=chrome, chrome={userDataDir=C:\Users\KIBS300\AppData\Local\Temp\scoped_dir20720_6699, chromedriverVersion=2.22.397933 (1cab651507b88dec79b2b2a22d1943c01833cc1b)}, rotatable=false, locationContextEnabled=true, mobileEmulationEnabled=false, version=51.0.2704.103, takesHeapSnapshot=true, cssSelectorsEnabled=true, databaseEnabled=false, handlesAlerts=true, browserConnectionEnabled=false, webStorageEnabled=true, nativeEvents=true, hasTouchScreen=false, applicationCacheEnabled=false, takesScreenshot=true}]

M
Replied on 30/07/2016

[b:f5irrzyk]NOTE:I CAN CLICK SAME LINK IN FIREFOX BROWSER.[/b:f5irrzyk]
Sir, i tried following solutions:

1>updated to latest chromedriver.
2>Used explicit wait

[b:f5irrzyk][b]w.manage().timeouts().implicitlyWait(25, TimeUnit.SECONDS);
WebElement toclick=w.findElement(By.xpath("//*[@id='link_1_Title']"));
WebDriverWait wait = new WebDriverWait(w, 1000000000);

wait.until(ExpectedConditions.elementToBeClickable(toclick));
toclick.click();[/b:f5irrzyk][/b]

3.instead of relative xpath ,tried [b:f5irrzyk]absolute xpath[/b:f5irrzyk]....

[b:f5irrzyk]Sir, none of them worked....
Please give your inputs on this....[/b:f5irrzyk]


M
Replied on 30/07/2016

[b:3m53wfn4]I tried scrolling to element & den clicking it[/b:3m53wfn4]

w.manage().timeouts().implicitlyWait(25, TimeUnit.SECONDS);
WebElement toclick=w.findElement(By.xpath("//*[@id='link_1_Title']"));

((JavascriptExecutor) w).executeScript("arguments[0].scrollIntoView(true);", toclick);
try {
Thread.sleep(500);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
WebDriverWait wait = new WebDriverWait(w, 1000000000);

wait.until(ExpectedConditions.elementToBeClickable(toclick));
toclick.click();


[b:3m53wfn4]Issue not resolved sir.
Please give ur inputs sir.[/b:3m53wfn4]


M
Replied on 30/07/2016

MORE INFO:
=================
For this link following was the status before i tried clicking it

System.out.println(toclick.isDisplayed());--------------------->[b:7o327v7x]True[/b:7o327v7x]
System.out.println(toclick.isEnabled());--------------------->[b:7o327v7x]True[/b:7o327v7x]
System.out.println(toclick.getText());--------------------------->[b:7o327v7x]SonSo[/b:7o327v7x]


M
Replied on 30/07/2016

Responsive image Responsive image Responsive image Responsive image Responsive image Responsive image Responsive image
Actions A=new Actions(w);
A.moveToElement(toclick).click().build().perform();
System.out.println("last statement");
[b:1pxyre9t]
This wont work tooo[/b:1pxyre9t]


M
Replied on 30/07/2016

Sir.......


I can click this link only via javascripexecutor......

JavascriptExecutor executor = (JavascriptExecutor)w;
executor.executeScript("arguments[0].click();", toclick);


[b:15w1swym]Sir , then is my chrome browser incompatible with chromedriver ?[/b:15w1swym]


M
Replied on 30/07/2016

This also wont work:

Actions A=new Actions(w);
//A.moveToElement(toclick).click().build().perform();
A.moveToElement(toclick, [b:2ssrds3s]186, 680[/b:2ssrds3s]).click().build().perform();

Pls put forth ur inputs.......


M
Replied on 30/07/2016

share the code please