Issue
As I am aware that user can click on Particular Webelement by using click method and one more way like using Sendkey Method with ASCII Value for left Click.
By Click Method: driver.findElement(By.cssSelector(".dbl")).click();
By Ascii Value : driver.findElement(By.cssSelector(".dbl")).sendKey("ASCII VALUE FOR Left Click");
Apart from this is there a way to perform click action??
Solution
You can use:
yourelement.sendKeys(Keys.RETURN)
or .sendKeys(Keys.ENTER)
: which is an equivalent of focusing that element and hitting RETURN/ENTER on that element
Also, There are methods to do this using Javacript but it is not usually recommended:
using the non-native Javascript Executor:
((JavascriptExecutor) driver).executeScript("arguments[0].click();", yourelement);
or by using Javascript Library:
JavascriptLibrary jsLib = new JavascriptLibrary();`
jsLib.callEmbeddedSelenium(driver, "triggerMouseEventAt", we, "click", "0,0");
Answered By - Prateek
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.