JavaScriptExecutor With Selenium WebDriver - Session 12

Поділитися
Вставка
  • Опубліковано 6 лют 2025
  • Do something amazing and cool stuff with JavaScriptExecutor With Selenium WebDriver:
    1. Highlight an Element
    2. DrawBorder around an Element
    3. Generate custom Alert during Test Execution
    4. Click on an Element by using JaveScript
    5. Refresh browser by using JavaScript
    6. Get Title by using JavaScript
    7. Get InnerText of page by using JavaScript
    8. Scroll Into View and Scroll Page Down
    Download this Libray from here:
    drive.google.c...
    ========================================================
    +Must have feature Highlight element Selenium for better execution.
    In Automation, testing sometimes element highlighter plays very important role.
    It helps us to track our execution flow which step is being processed. Some tools like QTP, Sahi etc. you will get this inbuilt feature.
    For Selenium, we have to write small code, which simply highlights element based on our parameter values. let’s get started and see Highlight element Selenium using CSS values.
    In Selenium, we can use JavascriptExecutor (interface) to execute Javascript code into webdriver.
    --Refer this video - how to highlight an Element using JS:
    • Highlight elements usi...
    ========================================================
    Subscribe to this channel, and press bell icon to get some interesting videos on Selenium and Automation:
    / naveenautomationlabs
    Follow me on my Facebook Page:
    / naveenqtpexpert
    ~-~~-~~~-~~-~
    Follow my Site/Blog: www.naveenautom...
    ========================================================
    Please watch: "Selenium & Automation Interview Preparation - By Naveen AutomationLabs"
    • Selenium & Automation ...
    ~-~~-~~~-~~-~ Subscribe to this channel, and press bell icon to get some interesting videos on Selenium and Automation:
    www.youtube.co...
    Follow me on my Facebook Page:
    / naveenqtpexpert
    Let's join our Automation community for some amazing knowledge sharing and group discussion on Telegram:
    t.me/joinchat/...
    Paid courses (Recorded) videos:
    Java & Selenium Course: www.naveenautom...
    API Course: www.naveenautom... ➡️Get Our Courses✔️
    📗 Get My Paid Courses at
    Paid courses (Recorded) videos:
    Java & Selenium Course: www.naveenautom...
    API Course: www.naveenautom...
    -------------------------------
    ✔️SOCIAL NETWORKS
    Facebook: / naveenqtpexpert
    Twitter: / naveenkhunteta
    Blog: www.naveenautom...
    --------------------------------
    Support My Channel✔️Or Buy Me A Coffee
    Paypal: paypal.me/nave...
    Google Pay: naveenanimation20@gmail.com
    --------------------------------
    ✔️Thanks for watching!
    देखने के लिए धन्यवाद
    Благодаря за гледането
    感谢您观看
    Merci d'avoir regardé
    Grazie per la visione
    Gracias por ver
    شكرا للمشاهدة

КОМЕНТАРІ • 83

  • @anglesloving
    @anglesloving 5 років тому +2

    Thank you for providing the reasoning behind JSE concepts. I always searched numerous JSE videos for finding answer to WHY! and finally found your tutorial as the puzzle solver. Thanks much Naveen. These are really helpful!

  • @naveenautomationlabs
    @naveenautomationlabs  7 років тому

    Download Full Selenium Java Code base from GIT: github.com/naveenanimation20/SeleniumJavaCourse

  • @Mr_Raz_
    @Mr_Raz_ Рік тому

    Really Helpful , Thank you so much . The way you explain I am really glad you exist on UA-cam.

  • @omkarpotdar2763
    @omkarpotdar2763 2 роки тому +1

    Thank you very much Naveen for making this topic very easy. After watching your videos it feels very confident about particular topic. Keep it up☺

  • @bharathireddy9790
    @bharathireddy9790 2 роки тому

    Great knowledge sharing.

  • @arjunraj7111
    @arjunraj7111 4 роки тому +3

    good video..The way u explain the concepts really deserves a praise naveen

    • @naveenautomationlabs
      @naveenautomationlabs  4 роки тому +1

      Thanks a ton

    • @sagehudson2408
      @sagehudson2408 3 роки тому

      A tip : watch series on kaldrostream. Me and my gf have been using it for watching a lot of movies recently.

    • @bodietitan557
      @bodietitan557 3 роки тому

      @Sage Hudson yup, I've been using KaldroStream for since november myself :D

  • @engineerswfmcreation2663
    @engineerswfmcreation2663 5 років тому +1

    Thank you, dear Naveen, you are Awesome Human Being.

  • @jdhung
    @jdhung 4 роки тому +1

    excellent tutorial. Thank you so much for sharing your knowledge.

  • @madhuria4606
    @madhuria4606 3 роки тому

    Awesome explanation about JS

  • @averageconsumer5374
    @averageconsumer5374 5 років тому +12

    but nowadays some interviewers are asking syntax.
    I don't know how a person can remember all the syntaxes.
    I'm attending interviews nowadays, if interviewer is Indian lady, they always want proper syntax, correct method names, etc.
    I was asked to write exact code for read data from excel, scroll down syntax, expect wait syntax etc
    even for first written test they are asking java program with excel with syntax not pseudocode.
    In real life we used to copy paste and edit, i don't know why they asking syntax like a teacher in school/college. who will mug up everything?

    • @aniruddhvale
      @aniruddhvale 5 років тому +1

      Syntax is way too much. who remembers syntax..they should only focus on concepts and basics. Syntax keeps changing for different programming languages..java will have different syntax, python will have different and so will be c# and others. This is ridiculous really..

    • @chirunomulavenkatesh
      @chirunomulavenkatesh 4 роки тому

      Yeah bro recently interviewr asked me screenshot code with syntax , who remember that

    • @CuteWorld614
      @CuteWorld614 4 роки тому

      @@chirunomulavenkatesh for me same ,they asked syntax of screenshot code :(

  • @bahtiyarmuhsin6406
    @bahtiyarmuhsin6406 5 років тому +1

    HI naveen ,,,your java script concept are very useful thank you very much

  • @miraga5071
    @miraga5071 2 роки тому

    thank you so much!!! YOU are the BEST!!!

  • @sureshgarine
    @sureshgarine 4 роки тому +2

    Nice tutorial on JSExecutor with selenium, can you make one more video on how to handle some complex automation scenarios which is possible only with JSExecutor , which may not be possible usually with selenium library

  • @anuragrajput9112
    @anuragrajput9112 2 роки тому

    Thank you for the excellent tutorial I have a question about the drawn border. How to draw a border if the page has multiple buttons and any one of them button got failed?

  • @bihari1422
    @bihari1422 2 роки тому

    Hey Naveen, why are we carrying "driver" in every method??
    I think we can declare it as class variable so that we dont need to repeat that again and again

  • @thiery572
    @thiery572 5 років тому

    Very cool feature.

  • @saiful021107
    @saiful021107 7 років тому +1

    Hi Naveen, You did great job. Thanks

  • @NIRMALKUMAR-xo5kh
    @NIRMALKUMAR-xo5kh 3 роки тому

    Hi Naveen your automation testing videos really helpful for me to learn automation testing....
    Thank you so much...
    And I have one doubt how to perform double click operation using JavaScript Executor

  • @sridevireddy1371
    @sridevireddy1371 7 років тому +1

    Very clear...tq Naveen

  • @desertstar7664
    @desertstar7664 7 років тому +1

    Awesome video Naveen !

  • @dragonkingm2
    @dragonkingm2 6 років тому +1

    Very good explanation

  • @momentsofsabyasachi4278
    @momentsofsabyasachi4278 6 років тому

    Great Video

  • @jaganathpradhan7458
    @jaganathpradhan7458 3 роки тому

    Very good information on javascript. Sir can u pls show how to type some text using javascript as well when sendkeys function is not working.

  • @chiragsingla4018
    @chiragsingla4018 6 років тому +1

    Hi sir, i wanted to know how to get the DOM of active webpage into java program. As if i am passing the url to java program it only gives the static DOM but not the DOM created after ajax.

  • @jaberahmedrana1646
    @jaberahmedrana1646 3 роки тому

    hi naveen, i am having a issue. while i pass the value using javascript, it takes the value, but when it clicks on signin it says username cant be empty. please suggest. thanks

  • @real_hello_kitty
    @real_hello_kitty 4 роки тому

    Thanks.😀

  • @sumayazamasyed8982
    @sumayazamasyed8982 6 років тому

    Hi naveen, please tell me why you're passing driver in every method and as well as while calling methods from the main() method...?

  • @meenuhembrom165
    @meenuhembrom165 5 років тому

    i am executing to automate video with javascript but the play,mute,unmute,pause ,,all these are not working
    using without flash driver.
    and accesing 6 videos though msexcelbut the loop that is running is not able to find those javasript arguement,
    guide me ..

  • @SunnyCool1110
    @SunnyCool1110 6 років тому

    Hi Navin, I am not able to get title of the screen. I have written the same code as u have written in this video. Please help me out.

  • @riyachowdary9984
    @riyachowdary9984 3 роки тому

    Hi Naveen. Thank you for the great content. For the last trick of scrolling till the end where we find forgot password link, why do we need this coding as we already scrolled there to spy the web element? Even for two days facebook post, we go there to that post to spy the web element and write the code, then what more is this javascript code helping us when we already scrolled to the end or till that facebook post?

  • @rakhimodi7698
    @rakhimodi7698 4 роки тому

    can someone please help me understand is there a performance difference between JS or selenium methods like get title, browser refresh?

  • @immanuelsamuelgwu
    @immanuelsamuelgwu 3 роки тому

    It will be good If you can make a video on how to use web event listener on Javascript executor.

  • @dhananjayprasad5197
    @dhananjayprasad5197 7 років тому +1

    can anyone help me whenever we writting JavaScript for hidden webelement OR for any query then why we are giving "arguement[0].click()" bcz if our hidden element will be in 2nd position then also it will work.

  • @nandiniarumugam9772
    @nandiniarumugam9772 7 років тому +1

    Good explanation

  • @kgip11
    @kgip11 4 роки тому +1

    Thanksssssssssssss a lot

  • @neerajsingh-lc3hw
    @neerajsingh-lc3hw 3 роки тому

    @naveen could u please tell me how to disable animation using this.

  • @HenixII
    @HenixII 4 роки тому +1

    31:00 for scrolling

  • @ravivadlamudi654
    @ravivadlamudi654 6 років тому

    Hey Naveen,
    In this same example, I have tried to take screenshot after the alert generation and it didn't get any screenshot. Is there any reason for this ?

  • @ajayshehrawat5430
    @ajayshehrawat5430 5 років тому

    Hi Naveen, Thanks for the video. When I am using scrollIntoView function then page partially scroll. Please help me with this.

  • @rakhigarg7200
    @rakhigarg7200 4 роки тому

    Do you conduct paid training at individual level

  • @nishantramkabir
    @nishantramkabir Рік тому

    Can anyone provide video name of custom xpath that naveen is talking about

  • @adityaaggarwal1
    @adityaaggarwal1 3 роки тому

    Hi Naveen
    Your telegram link is expired. Could you please share a new link ?

  • @jiniamitra7593
    @jiniamitra7593 6 років тому +1

    Please make video on drag and drop using JavascriptExecutor

  • @tourofindia4155
    @tourofindia4155 4 роки тому

    How to double click using Javascript ?

  • @dhananjayprasad5197
    @dhananjayprasad5197 7 років тому +2

    DHANANJAY PRASAD, [26.01.18 20:58]
    interview question Q1 : if we are able to download one file manually but if we have written automation script correctly then we are not able to download then were will be problem or which kind of exception we will get
    DHANANJAY PRASAD, [26.01.18 21:01]
    manager round Q2: if we have given our developed product to production server ok but later we came to known we have written some wrong script then what will we do

    • @raj2790
      @raj2790 6 років тому

      Any leads?

  • @amolzodage2455
    @amolzodage2455 6 років тому

    Hey hi Naveen ..I am able to perform operation for screenshot... After typing second line which is
    FileUnits copeFile then it is showing one comment but we dont have any valuable suggest over there after clicking on that..Can you do the needful...
    Is there another way to do that...Or we are missing anything in between ..??

    • @Mac17271
      @Mac17271 6 років тому

      Selenium 3 and above doesn't come with Apache Commons IO anymore.
      Just include the jar manually or add maven dependency. It will work fine.

    • @sangeetha.k.g.1326
      @sangeetha.k.g.1326 4 роки тому

      It is Fileutils.CopyFile

    • @sangeetha.k.g.1326
      @sangeetha.k.g.1326 4 роки тому

      It is Filtutils.CopyFile

  • @praveenautomationinterview2367
    @praveenautomationinterview2367 7 років тому +1

    Awesome!!

  • @ashishkumarnaik4255
    @ashishkumarnaik4255 3 роки тому

    When to use ";" when to not , its very confusing

  • @MrMadhur18
    @MrMadhur18 7 років тому +2

    Hi Naveen , if i am using the border thing in my script then how i can identify the element that some bug is there and i have to make the border here

  • @ashishrawal1499
    @ashishrawal1499 5 років тому

    if java executor is that much helpful then why we do not always prefer it. Please answer anyone

    • @Siva-en9sw
      @Siva-en9sw 5 років тому

      Because execution is slow bro, it will be good for very minimal execution.

  • @sunny_sunny28
    @sunny_sunny28 6 років тому

    Hello Naveen i am new to this automation testing field so can you please upload a video on how to handle reCaptcha ( I am not a robot)

    • @Siva-xq1qd
      @Siva-xq1qd 6 років тому

      If you automate captcha then that website is not secured, So do not try to violate
      the security of the web. If an interviewer is asking this question he is trying to check your genuine experience in the test.

    • @sunny_sunny28
      @sunny_sunny28 6 років тому

      @@Siva-xq1qd no but I have done it ,we can also automate captcha imeages

  • @shashankchandragiri7347
    @shashankchandragiri7347 3 роки тому

    hi naveen please provide radio button class

  • @amolnawale2177
    @amolnawale2177 6 років тому

    Hi Naveen, how do we call the drawBorder(element, driver) method when we dont know which element in our test scripts is going to fail? Calling this method on each and every webelement also dont make sense. In short, I am repeating the same question that Madhur Bhardwaj had asked below.

  • @gitapriyadarshinik1978
    @gitapriyadarshinik1978 6 років тому

    Hi Naveen,I have a doubt....instead of sending driver and performing casting in every method ,cant we pass "js" instead directly,so that we can use it directly.Can you Please clarify.

  • @sammy22391
    @sammy22391 6 років тому

    Hi I want to select element from dropdown using JavaScriptExecutor ,Could you please tell me which tutorial of ur's should I have to refer to ? I have trouble using JavaScriptExecutor , your help will be very much appreciated.... thanks in advance !

  • @GauravSingh-ik6gz
    @GauravSingh-ik6gz 6 років тому

    Hi Naveen,
    Can i alter the html by javascript executor? Like to replace all the images in webpage with the one i have ?

  • @PatelsProdcast
    @PatelsProdcast 6 років тому

    Hello Naveen. Thank you so much for the video tutorials. I have a question. How can I perform click after scrollToView. I find the forgot password link. how can i perform click on it after scrolling down? ive tried .click () but I dont know how to proceed further.

  • @ravikumar-lk5we
    @ravikumar-lk5we 7 років тому +2

    Sir I am facing lots of issue with javascriptexecutor concept...I am unable to decode the code and analyze and understand it...

  • @ravikumar-lk5we
    @ravikumar-lk5we 7 років тому +1

    Sir everytime in executeScript method you put "Semicolon"(;)...Why is the reason to put semi colon..
    Plzz tell

  • @amritbhinder417
    @amritbhinder417 6 років тому

    Hello Naveen, how to perform drag and drop using JavaScript executor? It says selenium doesn't support drag and drop in HTML 5 so may be there is a work around using JavaScript executor. Can you please help.

  • @mallikarjunakambham7346
    @mallikarjunakambham7346 6 років тому

    In the same freeCRM Web page, If I scroll for the text "Companies & Contacts" by using scrollIntoView method, i am not able to get exact Result. the text is hiding behind the Header static page. You can try this Once. How to over Come this kind of Problems in real Time...

  • @jayapreetkaur3841
    @jayapreetkaur3841 6 років тому

    Hi Naveen I got stuck on signup page of flipkart where my sendKeys (Mobile number) were not going through it was normal pop up means it was not an alert or window pop up, it was written under div however using java script executor it was going through, but i want to know the reason behind it. please help me in this.

  • @ragavendrad574
    @ragavendrad574 6 років тому

    I want know why u have used open and closed brackets for JavaScript Executor and driver along with it. JavascriptExecutor js = (JavascriptExecutor) driver;