Highlight elements using JavaScriptExecutor - Selenium WebDriver Session 11

  Рет қаралды 79,667

Naveen AutomationLabs

Naveen AutomationLabs

Күн бұрын

Пікірлер: 75
@gangadharasastryg2851
@gangadharasastryg2851 2 жыл бұрын
Hi Naveen, Thank you! Pasting code below for future viewers. public static void flash(WebElement element,WebDriver driver) { JavascriptExecutor js=(JavascriptExecutor)driver; String bgcolor = element.getCssValue("backgroundcolor"); for(int i=0; i
@viveksalgaonkar1005
@viveksalgaonkar1005 3 жыл бұрын
Hey Naveen, your teaching is excellent you make it so easy to understand. Really appreciate it.
@omkarpotdar2763
@omkarpotdar2763 2 жыл бұрын
Good job Naveen, this session really help me to understand the concept of JavaScriptExecutor. Thank you so very much.
@sakshiaggarwal6199
@sakshiaggarwal6199 6 ай бұрын
Thank you so much Naveen!!🙏🙏
@karthikkumaresan1091
@karthikkumaresan1091 2 жыл бұрын
nice video to understand this concept. Thank yu
@kalyanijoshi6884
@kalyanijoshi6884 5 жыл бұрын
How do we implement this in framework? for each and every element i have to add this or is there any better option?
@humasheikh8911
@humasheikh8911 7 ай бұрын
Hi Naveen,Please explain why driver is passed in parameter for JavascriptExecutor
@purushothammb9096
@purushothammb9096 6 жыл бұрын
Hi Naveen, How to capture the screenshot with the element highlighted state? I want to add it my extent report , I've implemented this in my code , my code is highlighting the WebElement but in the screenshot I don't see the WebElement with highlighted state. How to achieve this with the code ? Please suggest me. Thanks.
@sagarpateldon
@sagarpateldon 2 жыл бұрын
if someone is not able to see Highlight elements or flashing element .you can give some wait time between changing color like this --------> public static void flash(WebElement element, WebDriver driver) throws InterruptedException { String bgcolor = element.getCssValue("backgroundColor"); for (int i = 0; i
@Ashishbains25
@Ashishbains25 6 жыл бұрын
Worked fine for me. Thanks :)
@swatidubey4669
@swatidubey4669 6 жыл бұрын
Hi Naveen , are these 65 tutorials in this playlist are sufficient to crack any selenium interview ?
@sarojjha9243
@sarojjha9243 4 жыл бұрын
Yes it is
@testautomation6100
@testautomation6100 3 жыл бұрын
Hi Naveen, A quik quation i have. I am unable to find the executescrip() method in my eclipse may there is no jar file available for this class or something else I unable to understand could you please assist.? thank you
@PreetiGupta-qz1nw
@PreetiGupta-qz1nw 5 жыл бұрын
Hi Naveen, Your videos are so amazing. Its easy to understand..Excellent work.
@naveenautomationlabs
@naveenautomationlabs 5 жыл бұрын
Thanks for watching it @Preeti Gupta.
@Bhavi585
@Bhavi585 2 жыл бұрын
Can we achieve this by using specific XPath for multiple fields at a time and the qmetry report also shows the highlighting those fields
@LittleTanish
@LittleTanish 2 жыл бұрын
Hello, I have highlight elements method but I need to use this method using listeners in selenium 4. I tried use driver.register(highlight) method but this is not working in selenium 4
@mayursapre698
@mayursapre698 6 жыл бұрын
Hi Naveen, At 8.08min You mention Javascriptexecutor as Class but its Interface
@kanikagupta8534
@kanikagupta8534 2 жыл бұрын
Hi Naveen, I am using eclipse and I am not being able to perform executeScript(). I am getting the error below. The method executeScript(String, WebElement) is undefined for the type JavaScriptExecutor. Can you please help me out with it?
@AnuragVerma29
@AnuragVerma29 6 жыл бұрын
Hi Naveen, In my eclipse I am not able to use executescript(). What could be an issue ? should I need to download any jar file ?
@reddy4143
@reddy4143 3 жыл бұрын
No It will be word and please share the code to. My what's number 6303698052
@AnuragVerma29
@AnuragVerma29 3 жыл бұрын
@@reddy4143 Thanks brother, but that problem I faced 2 years ago, but again thanks for your concern.
@andreidiachenko5708
@andreidiachenko5708 3 жыл бұрын
BRAVO
@ruchi210
@ruchi210 5 жыл бұрын
Naveen can you please start online classes.. want to join some regular online class
@reddy4143
@reddy4143 3 жыл бұрын
Thank you sir
@reddy4143
@reddy4143 3 жыл бұрын
I got job mostly your Jenkin video impressed
@skjahangir3800
@skjahangir3800 3 жыл бұрын
Can you please make a video of scrolling and performing some action like checking the check boxes randomly Thank you
@fahimbaig1
@fahimbaig1 2 жыл бұрын
Pasting the below code WebElement continueBtn = driver.findElement(By.id("continue")); flash(continueBtn, driver); public static void flash(WebElement element, WebDriver driver) { JavascriptExecutor js = (JavascriptExecutor) driver; String bgcolor = element.getCssValue("backgroundColor"); for (int i=0; i
@bashaneerati
@bashaneerati 4 жыл бұрын
Hi Naveen! .. is the any another Syntax for Jsexecutor... In your point of view it is very complex.... Can u provide less syntax code for jsExecutor
@ManjunathPrabhakar
@ManjunathPrabhakar 4 жыл бұрын
This is one of the easiest way!
@SherineVishal
@SherineVishal 4 жыл бұрын
Like all your videos. Thanks for sharing. One thing, do we need JavascriptExecutor object in flash class
@ManjunathPrabhakar
@ManjunathPrabhakar 4 жыл бұрын
In this video flash is a method. And as per usage here JS exec is unused in flash method, hence not needed within flash. But in other method JS exec is needed since we are using css styling to applying bg color.
@aspp8137
@aspp8137 4 жыл бұрын
Hi Naveen,I am getting the error Exception in thread "main" java.lang.ClassCastException: org.openqa.selenium.chrome.ChromeDriver cannot be cast to seleniumSessions.javascriptExecutor at seleniumSessions.javascriptExecutor.flash(javascriptExecutor.java:37) at seleniumSessions.javascriptExecutor.main(javascriptExecutor.java:27) executeScript it is giving an error.how do i proceeed further to see highlight
@venmathir8751
@venmathir8751 2 жыл бұрын
Same for me. Did U find any solution
@rushikeshkhandave2011
@rushikeshkhandave2011 5 жыл бұрын
Hi how can we highlight list of web element using this
@kushagrapandey3671
@kushagrapandey3671 3 жыл бұрын
JavascripExecutor is a class or interface?
@rajendrakumarnayak5103
@rajendrakumarnayak5103 3 жыл бұрын
Hi Naveen Sir, I've following your videos and have understood the code well, I tried the above code on a sample website and it shows an exception error: Exception in thread "main" org.openqa.selenium.JavascriptException: javascript error: argument is not defined for the method - flash(loginBtn, driver); Kindly please help me understand where does it actually gets stuck. Regards, Rajendra.
@anumarwaha2010
@anumarwaha2010 Жыл бұрын
I am also stuck at same the point . Kindly provide solution
@ravinderjill9961
@ravinderjill9961 6 жыл бұрын
HI naveen how do i upload image and take screen shot
@Linga-yp1bw
@Linga-yp1bw 5 жыл бұрын
For Uploading File We Need to use autoit and take screenshots we have method take screenshot mehod
@fathimasyed4232
@fathimasyed4232 4 жыл бұрын
How to capture the color while move over an element...i tried with action class .. but it comes out ..let me know if anyone know and done successfully...
@itindranil
@itindranil 4 жыл бұрын
JavaScriptExecutor is a class or Interface ?
@ManjunathPrabhakar
@ManjunathPrabhakar 4 жыл бұрын
Interface. Look at this www.selenium.dev/selenium/docs/api/java/org/openqa/selenium/JavascriptExecutor.html
@madhusmitasahoo1061
@madhusmitasahoo1061 5 жыл бұрын
Hi Naveen, thanks for the video. I am getting error as rgb(int, int, int) is not defined. Can you help? Thanks
@desifoodie8371
@desifoodie8371 4 жыл бұрын
Please put inside quotation as shown
@ParasJoshiPj
@ParasJoshiPj 5 жыл бұрын
Hi naveen please one make video on CI CD with live example...how we can do ci cd if developer will give the new cr build for this free crm website then how i will run these script automatically.
@sabbirahamed1894
@sabbirahamed1894 10 ай бұрын
How this highlight help the test or quality ? These are for new selenium users. In the real-life most important is your detailed and effective testcase. Because each additional line of coding will take time from your testing end. So, learn this but avoid using it for real-life.
@naveenautomationlabs
@naveenautomationlabs 10 ай бұрын
Its not like this, you can always create a generic function and call this function in the basis of the feature flag true or false. This is useful when you want to highlight the element during the execution while giving demo or debugging. If you don't want to use , make the feature flag false. In framework it's not about test or quality, it's about adding some out of the box features to decorate the framework to understand the debugging and execution properly.
@sabbirahamed8554
@sabbirahamed8554 10 ай бұрын
Naveen , I luv to watch ur videos., It's nothing related ur quality. But where you will use it in real life for what. As u know in real life we dont do show boat. In framework u have to add it as global from ur common methods, so it will run the method for all the testcases. It will add time for test running time and also it will increase testcase run failure rate. As u know selenium open source. Because it is not a part of test or it will not help u for quality. It will only help the click part for display (not the whole coverage)and we dont really need that. For display , we have limitation in selenium as u know. We can only make sure HTML & CSS and javascripts. Rest r not selenium , just java....because I m using java
@techxpert7403
@techxpert7403 4 жыл бұрын
I want to implement this in robot framework , please share the detailed step
@nikhathk5677
@nikhathk5677 4 жыл бұрын
WebElement element and Webdriver driver is giving error, please find the screenshot public static void flash(WebElement element, WebDriver driver){ JavascriptExecutor js= (( JavascriptExecutor)driver) ; String bgcolor=element.getCssValue("backgroundColor"); for(int i=0; i>10;i++){ changeColor("rgb(0,200,0)", element, driver); changeColor(bgcolor, element, driver); } } public static void changeColor(String color, WebElement element, WebDriver driver) { JavascriptExecutor js =((JavascriptExecutor) driver); js.executeScript("arguments[0].style.backgroundColor = '"+color+"'", element); try{ Thread.sleep(20); } catch(InterruptedException e){} }
@ManjunathPrabhakar
@ManjunathPrabhakar 4 жыл бұрын
What is the Error
@ParasJoshiPj
@ParasJoshiPj 5 жыл бұрын
Naveen will it decrease our automation speef
@ManjunathPrabhakar
@ManjunathPrabhakar 4 жыл бұрын
Yes. Culprit is thread.Sleep(). It's fine for debugging. However in actual production there are workaround to avoid it.
@Sifat1441
@Sifat1441 Жыл бұрын
Hi Navin, JavascriptExecutor is not a class. It's an interface
@niteshrawat576
@niteshrawat576 6 жыл бұрын
Hi Naveen, hope you are good. Will executing the script i am having an exception which says"undefined argument". I have carefully check all the code and make sure all arguments (element ,driver,color) are properly defined. Cam you please help me out with this issue. You can share me your email if you wanna review the code. Thanks in advance!!
@chandrahasdhandeti8898
@chandrahasdhandeti8898 6 жыл бұрын
javascriptexecutor is a interface right
@sandeepredhu2035
@sandeepredhu2035 6 жыл бұрын
Its a class
@RohitShinde-xh7vo
@RohitShinde-xh7vo 5 жыл бұрын
@@sandeepredhu2035 Its an interface
@ankitsrivastava1126
@ankitsrivastava1126 6 жыл бұрын
Hi Naveen my question is if our Application does not designed form Java Script then will JS Executor work, i think not. please answer ....
@naveenautomationlabs
@naveenautomationlabs 6 жыл бұрын
It will work.
@aryanroy9078
@aryanroy9078 5 жыл бұрын
Hi, can you please guide me to find or make xpath in ie11 for execute script in selenium
@deepakpatil2397
@deepakpatil2397 5 жыл бұрын
please refer the below link to highlight the any element. www.softwaretestingmaterial.com/highlight-element-using-selenium/
@shwetachoudhary1314
@shwetachoudhary1314 3 жыл бұрын
javascriptexecutor is an interface and not a class, right?
@yahankc007
@yahankc007 3 жыл бұрын
Right
@megalashanmu2177
@megalashanmu2177 5 жыл бұрын
I am unable to implement The method executeScript, unable to pass the webelement in this. It says executeScript.(String, Object[]) in the type JavascriptExecutor is not applicable for the arguments (String, WebElement) can u help me ??
@JAYITAMs
@JAYITAMs 5 жыл бұрын
try this without creating method WebElement loginButton = driver.findElement(By.xpath("//input[@type='submit']")); JavascriptExecutor js = (JavascriptExecutor) driver; //Here i pass values based on css style. Yellow background color with solid red color border. js.executeScript("arguments[0].setAttribute('style', 'background: green; border: 2px solid yellow;');", loginButton);
@davidvilla5154
@davidvilla5154 7 жыл бұрын
hI Naveen, This Pop up still interrupting to my code. not typing log in and password...
@naveenautomationlabs
@naveenautomationlabs 7 жыл бұрын
try to click on that login button using javascriptexecutor.
@naveenautomationlabs
@naveenautomationlabs 7 жыл бұрын
use this code to click on login button: JavascriptExecutor js = (JavascriptExecutor)driver; js.executeScript("arguments[0].click();", driver.findElement(By.xpath("//input[@type='submit']")));
@parvesahammed3353
@parvesahammed3353 5 жыл бұрын
@@naveenautomationlabs tnx
@kalyanijoshi6884
@kalyanijoshi6884 5 жыл бұрын
Please share the code
@prashantmahajantanashah
@prashantmahajantanashah Жыл бұрын
I got the following error. The browser opened but it was not able to highlight and threw the error as below: Exception in thread "main" java.lang.ClassCastException: class org.openqa.selenium.chrome.ChromeDriver cannot be cast to class org.htmlunit.javascript.background.JavaScriptExecutor (org.openqa.selenium.chrome.ChromeDriver and org.htmlunit.javascript.background.JavaScriptExecutor are in unnamed module of loader 'app')
@prashantmahajantanashah
@prashantmahajantanashah Жыл бұрын
Used below methods:- public static void flash(WebElement element, WebDriver driver) { JavaScriptExecutor js = (JavaScriptExecutor)driver; String bgcolor=element.getCssValue("backgroundColor"); for(int i=0;i
JavaScriptExecutor With Selenium WebDriver - Session 12
43:10
Naveen AutomationLabs
Рет қаралды 112 М.
What is HTML DOM & StaleElement Exception in Selenium
36:04
Naveen AutomationLabs
Рет қаралды 82 М.
Accompanying my daughter to practice dance is so annoying #funny #cute#comedy
00:17
Funny daughter's daily life
Рет қаралды 15 МЛН
Молодой боец приземлил легенду!
01:02
МИНУС БАЛЛ
Рет қаралды 2 МЛН
Ice Cream or Surprise Trip Around the World?
00:31
Hungry FAM
Рет қаралды 22 МЛН
내맘대로 코디가능한 재미있는빈티지😜
1:40:58
바이예진빈티지
Рет қаралды 123
Handle Calendar/DatePicker using JavaScriptExecutor - Session -17
17:30
Naveen AutomationLabs
Рет қаралды 99 М.
Headless Browser Testing using HTMLUnitDriver in Selenium - Session 10
19:53
Naveen AutomationLabs
Рет қаралды 61 М.
How to find broken links & Images using Selenium Webdriver
45:35
Naveen AutomationLabs
Рет қаралды 99 М.
How to Handle Frames in Selenium Webdriver
27:03
Mukesh otwani
Рет қаралды 114 М.
How to Read Selenium WebDriver Java Doc
20:20
Naveen AutomationLabs
Рет қаралды 26 М.
Highlight Web Elements using JavascriptExecutor in Selenium WebDriver
12:59
Mystery of StaleElementReferenceException in Selenium WebDriver
18:10
Naveen AutomationLabs
Рет қаралды 51 М.
What is Selenium WebDriver Architecture?
50:38
Naveen AutomationLabs
Рет қаралды 150 М.
Accompanying my daughter to practice dance is so annoying #funny #cute#comedy
00:17
Funny daughter's daily life
Рет қаралды 15 МЛН