How can we override the click event of Webdriver at Abstract level.

747 megtekintés
Ugrás az első olvasatlan üzenetre

Prashant Kajale

olvasatlan,
2015. márc. 27. 2:01:212015. 03. 27.
– seleniu...@googlegroups.com
Hi,

While running test from my frame work against Chrome, most of the testcases fails with exception :-Element is not clickable at point (326, 792.5).

We have a work around for this using javascript.

But there are hundreds of click commands used in framework where causes issue while running against chrome browser.
So how can we override the click command of webdriver at one place with the available workaround and not at each place where this command is called.


Thanks,
Prashant.

Krishnan Mahadevan

olvasatlan,
2015. márc. 27. 23:01:102015. 03. 27.
– seleniu...@googlegroups.com
Prashant,

There is no straight forward way of doing this [ in any ways you would be required to sweep through your code and make changes in a lot of places ].

So what I would suggest is that you please consider creating a utility class [ Lets call it WebDriverUIActionsHelper] and define a click method in it, which takes in a WebElement as an argument and internally attempts to first invoke the WebElement.click() and if that doesn’t work, then resort to your JavaScript work-around.

That way, you still have abstracted out all the actual WebElement.click() calls and you don’t have to apply the workaround in each and every place.

Would that work for you ?

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/53367d39-ada6-4874-be89-4122536f309a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Neha Verma

olvasatlan,
2015. márc. 30. 14:37:512015. 03. 30.
– seleniu...@googlegroups.com
This Issue Max no of time occurs into Chrome,Can be do such way to prevent this using JS executor,and click on WebElement. :
Capabilities cp = ((RemoteWebDriver) driver).getCapabilities();
                if (cp.getBrowserName().equals("chrome")) {
                    try {
                        ((JavascriptExecutor) driver).executeScript(
                                "arguments[0].scrollIntoView(true);", webElement);
                    } catch (Exception e) {

                    }
                }

                webElement.click();

Mukesh otwani

olvasatlan,
2015. márc. 31. 12:43:232015. 03. 31.
– seleniu...@googlegroups.com
Hey Neha,

thanks for a nice code. It worked for me. Cheers 
Válasz mindenkinek
Válasz a szerzőnek
Továbbítás
0 új üzenet