Web Stories - Articles - Questions - Post - Experiences
menu search
brightness_auto
Add Knowledge - Updates - Promotion
more_vert

There are several cases which you can easily solve by using javascriptExecutor. The arguments[0] means the webElement passed in the executeScript command. You can use more than one argument. 

When you use only one element:

WebElement webElement0 = driver.findElement(By.xpath("xpath_element_0")); JavascriptExecutor javaScriptExecutor = (JavascriptExecutor)driver; javaScriptExecutor.executeScript("arguments[0].click()", webElement0);

When you use more than one element:

WebElement webElement0 = driver.findElement(By.xpath("xpath_element_0"));

WebElement webElement1 = driver.findElement(By.xpath("xpath_element_1"));

JavascriptExecutor javaScriptExecutor = (JavascriptExecutor)driver; javaScriptExecutor.executeScript("arguments[0].click(); arguments[1].click()", webElement0, webElement1); 

This script clicks on 2 element so we have used 2 arguments 

thumb_up_off_alt 2 like thumb_down_off_alt 0 dislike

Related questions

Now a days, everybody is talking about JSON. If you are a Software engineer, you will work with JSON. If you are an automation test engineer, you will...
What is json node and how many types of json node are there ?
thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike
0 answers
Read Story...
share
Searched so many websites? Did not find the exact answer of your query? No worries, we will try to answer. ImplicitWait: Where ever you write bel...
What is the technical difference between ImplicitlyWait & ExplicitWait in selenium webdriver?
thumb_up_off_alt 2 like thumb_down_off_alt 0 dislike
0 answers
Read Story...
share
thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike
1 answer
Read Story...
share
RestAssured is the java library which is used tp test REST APIs. It has very rich functionality. If you are working with maven project, you just need ...
thumb_up_off_alt 2 like thumb_down_off_alt 0 dislike
0 answers
Read Story...
share
Ads by Zaankari™ Portal
I am working in a multi national company. We are using TestNG6.9.5 based selenium java framework. Somehow my local setup deleted and now I have to re-...
I am not able to find TestNG6.9.5 in ecllipse, dl.bintray.com is also not working, what to do ?
thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike
0 answers
Read Story...
share
What are the Challenges you faced in Selenium automation?
thumb_up_off_alt 3 like thumb_down_off_alt 0 dislike
1 answer
Read Story...
share
Selenium is an automation testing framework for web and mobile apps. Selenium scripts are written in java/php/ruby/c# etc  e.g. Registration pag...
thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike
0 answers
Read Story...
share
Post your questions in java community
thumb_up_off_alt 2 like thumb_down_off_alt 0 dislike
1 answer
Read Story...
share
Ads by Zaankari™ Portal
There is a lot if confusions over wait topic in selenium. Which wait should be used when? What is the difference between Implicit,Explicty,Fluent wai...
What is Exact Difference Between WebDriverWait & FluentWait?
thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike
0 answers
Read Story...
share
Are you eating samosa, kachori, Jalebi, pakoda, french fries, smileys from market shops?    How many times they are reheating and reusing...
Is it dangerous to reuse same cooking oil? How many times can we reuse same oil?
thumb_up_off_alt 3 like thumb_down_off_alt 0 dislike
0 answers
Read Story...
share

Most popular questions within the last 4 days

Welcome to Zaankari portal, where you can ask and read questions/answers and stories. Add Questions/Stories/Posts - Earn Points !
...