How to Handle Multiple Windows in Selenium WebDriver

แชร์
ฝัง
  • เผยแพร่เมื่อ 14 พ.ค. 2020
  • In this video, I have shown how we can handle Multiple Windows in Selenium WebDriver.
    Window handles refer to the windows or tabs which were opened by the driver instance in selenium.
    Every window will have a unique string value to identify and we call that as a handle.
    Selenium provides two methods to get those handle values.
    1) getWindowHandle
    2) getWindowHandles
    ==== Get window handle =====
    WebDriver does not make the distinction between windows and tabs. If your site opens a new tab or window, Selenium will let you work with it using a window handle. Each window has a unique identifier that remains persistent in a single session. You can get the window handle of the current window by using:
    driver.getWindowHandle();
    ==== Get window handles =====
    You can get the window handles of the currently opened windows by using:
    driver.getWindowHandles();
    ==== Switching windows or tabs =====
    Clicking a link/button that opens in a new window will focus on the new window or tab on the screen, but WebDriver will not know which window the Operating System considers active. To work with the new window you will need to switch to it. If you have only two tabs or windows open, and you know which window you start with, by the process of elimination you can loop over both windows or tabs that WebDriver can see, and switch to the one which is not the original.
    Syntax:
    driver.switchTo().window(windowHandle);
    Code:
    //launches browser window with the mentioned URL
    driver.get("www.hyrtutorials.com/p/window...");
    //Store the ID of the parent window
    String parentWindow = driver.getWindowHandle();
    //Click the link which opens in a new window
    driver.findElement(By.id("newTabBtn")).click();
    //Loop through until we find a new window handle
    for (String windowHandle : driver.getWindowHandles()) {
    if(!parentWindow.contentEquals(windowHandle)) {
    driver.switchTo().window(windowHandle);
    driver.findElement(By.id("firstName")).sendKeys("yadagiri");
    break;
    }
    }
    ==== Closing a window or tab ====
    When you are finished with a window or tab and it is not the last window or tab open in your browser, you should close it and switch back to the window you were using previously. Assuming you followed the code sample in the above section you will have the previous window handle stored in a variable. Put this together and you will get:
    //Close the tab or window
    driver.close();
    //Switch back to the old tab or window
    driver.switchTo().window(parentWindow);
    ==============================================
    ************* Checkout my other playlists *************
    ==============================================
    Java Programming videos playlist:👇
    🔗 bit.ly/3keRJGa
    Selenium WebDriver with Java videos playlist:👇
    🔗 bit.ly/2FyKvxj
    Selenium interview questions videos playlist:👇
    🔗 bit.ly/3matUB3
    Windows automation with FlaUI videos playlist:👇
    🔗 bit.ly/33CG4dB
    CSS Selectors videos playlist:👇
    🔗 bit.ly/2Rn0IbD
    XPath videos playlist:👇
    🔗 bit.ly/2RlLdkw
    Javascript Executor videos playlist:👇
    🔗 bit.ly/2FhNXwS
    Apache POI videos playlist:👇
    🔗 bit.ly/2RrngrH
    Maven videos playlist:👇
    🔗 bit.ly/2DYfYZE
    How to fix Eclipse errors:👇
    🔗 bit.ly/3ipvNYf
    ==============================================
    ==============================================
    Connect us @
    🔗 Website - www.hyrtutorials.com
    🔗 Facebook - HYRTutorials
    🔗 LinkedIn - www.linkedin.com/company/hyrtutorials
    🔗 Twitter - Hyrtutorials
    ==============================================
    ==============================================
    🙏 Please Subscribe🔔 to start learning for FREE now, Also help your friends in learning the best by suggesting this channel.
    #selenium #windowHandles #multipleWindows #hyrtutorials #webAutomation

ความคิดเห็น • 151

  • @HYRTutorials
    @HYRTutorials  4 ปีที่แล้ว +4

    Please use the below link for the selenium videos playlist:
    🔗 bit.ly/2FyKvxj

  • @gnanasundari9226
    @gnanasundari9226 4 หลายเดือนก่อน

    Thank you for your wonderful explanation!!

  • @HussainAhmed-bl1ku
    @HussainAhmed-bl1ku ปีที่แล้ว +1

    Clear understanding for beginners. I love it and soon i will join.

  • @ellanewyork
    @ellanewyork ปีที่แล้ว +1

    Everything clear, Thanks!

  • @user-bz5on4ir5z
    @user-bz5on4ir5z 11 หลายเดือนก่อน +1

    Thank you so much for your clear explanation.👌👍👍👍👍

    • @HYRTutorials
      @HYRTutorials  10 หลายเดือนก่อน

      Happy learning buddy 😊

  • @priyankabhosale7609
    @priyankabhosale7609 3 ปีที่แล้ว +2

    very useful and explained in very nice way

  • @gouryraj381
    @gouryraj381 2 ปีที่แล้ว +1

    Wow very clearly explained..Thank you..ur way of explaining with app is nice. 🙏

  • @harshithaprakash852
    @harshithaprakash852 ปีที่แล้ว +1

    clearly explained, thank you :)

    • @HYRTutorials
      @HYRTutorials  11 หลายเดือนก่อน

      Thanks buddy 😊

  • @vishwa1416
    @vishwa1416 6 หลายเดือนก่อน

    Thanks for your explanation sir

  • @Bell4Fun
    @Bell4Fun 2 ปีที่แล้ว +1

    nicely explained .Wonderful

  • @peterwarsaw631
    @peterwarsaw631 2 ปีที่แล้ว

    So good explanation. Thanks

  • @subhanisyed6758
    @subhanisyed6758 3 หลายเดือนก่อน

    Wowww super explanation understood clearly

  • @swatihatwar163
    @swatihatwar163 2 ปีที่แล้ว +1

    NIce Explanation...Thank you

  • @user-in8dq8bx5f
    @user-in8dq8bx5f 10 หลายเดือนก่อน +1

    Awesome Explanation sir

    • @HYRTutorials
      @HYRTutorials  10 หลายเดือนก่อน

      Thanks buddy 😊

  • @mahendrabhore8877
    @mahendrabhore8877 ปีที่แล้ว +1

    Damn that helped me on very right time

  • @Mohit-kv7bq
    @Mohit-kv7bq 9 หลายเดือนก่อน

    Hello sir, you didn't mention the difference between window handle vs multiple tab handles practically 😢. How would selenium come to know whether its new window to be open or new tab to ope. As you said same code for both that is confusion. Please explain again

  • @factsofallahal-shaheedserv7816
    @factsofallahal-shaheedserv7816 2 ปีที่แล้ว +2

    Thank you

  • @rupadhyay73
    @rupadhyay73 3 ปีที่แล้ว +1

    Very nice 🙏🔥

  • @boyapatiramakrishna2068
    @boyapatiramakrishna2068 2 ปีที่แล้ว +1

    Brother, eventhough I used thread.sleep or implicit wait after Navigation to new url, the execution stops after navigation to new url. The code is not executing the next lines of code. I have used thread.sleep also and implicit wait also. Can you answer to this problem, stack overflow also doesn't have the answer.

    • @HYRTutorials
      @HYRTutorials  2 ปีที่แล้ว

      Can you send the screenshot and video on hyadagirireddytutorials@gmail.com

  • @suganyakrishnan1335
    @suganyakrishnan1335 4 ปีที่แล้ว +2

    good work

  • @mjadhitya3874
    @mjadhitya3874 2 ปีที่แล้ว +1

    I to use the same code but in if statement "driver.switchTo().window(...)" in that place handle option didn't shown to it shows only parenthandle option only

    • @HYRTutorials
      @HYRTutorials  2 ปีที่แล้ว

      Can u paste the code here

  • @shivatapasya1910
    @shivatapasya1910 หลายเดือนก่อน

    Sir ,im getting element click exception , how to solve this one ?

  • @user-ws4pj1wm6n
    @user-ws4pj1wm6n 3 หลายเดือนก่อน

    Thanks

  • @kranthikumarbejjanki
    @kranthikumarbejjanki 3 ปีที่แล้ว +1

    Good work bro.. 👍👍

  • @KARTIK865
    @KARTIK865 3 ปีที่แล้ว +3

    how to store multiple window handles in the set and how to we get to know which handle is the one we need to switch to? can you suggest something for that?

    • @HYRTutorials
      @HYRTutorials  3 ปีที่แล้ว +3

      When u use getWindowHandles(), it automatically returns the set for you.
      Every window handle is a unique identifier, so if you want to know which handle is for which window then you can switch to each window and get the title.
      if you want to switch to the window based on the title then iterate all the window handles and switch to each window handle then immediately check the title and if that is the target title then break the iteration.

    • @abdulrahaman176
      @abdulrahaman176 3 ปีที่แล้ว +2

      @@HYRTutorials Please make video on above scenario

    • @dandasweetmouni4758
      @dandasweetmouni4758 2 ปีที่แล้ว

      @@HYRTutorials Awesome explanation. If you have code for remaining scenarios like multiple windows that will be helpful to selenium learners.

    • @HYRTutorials
      @HYRTutorials  2 ปีที่แล้ว

      @@dandasweetmouni4758 the concept is same for all the window handles.
      If you have understood the above video fully then you will be able to handle any kind of window handle scenario.

    • @Bell4Fun
      @Bell4Fun 2 ปีที่แล้ว

      @@abdulrahaman176 String parenthandle = driver.getWindowHandle();
      System.out.println("pHandle:--" + parenthandle);
      driver.findElement(By.id("newTabsBtn")).click();
      Set handles = driver.getWindowHandles();
      for (String handle : handles) {
      System.out.println("cHandle:--" + handle);
      if (!handle.equals(parenthandle)) {
      driver.switchTo().window(handle);
      String title = driver.getTitle();
      System.out.println(title);
      switch (title) {
      case "AlertsDemo - H Y R Tutorials":
      driver.findElement(By.id("alertBox")).click();
      driver.switchTo().alert().accept();
      driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
      driver.close();
      break;
      case "Basic Controls - H Y R Tutorials":
      driver.findElement(By.id("firstName")).sendKeys("India");
      driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
      driver.close();
      break;
      default:
      System.out.println("No Windows found");
      break;
      }
      }
      }
      driver.switchTo().window(parenthandle);
      driver.findElement(By.id("name")).sendKeys("Parent window");
      driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
      //driver.quit();

  • @sanketpatil3243
    @sanketpatil3243 หลายเดือนก่อน

    If we have multiple child windows and we have to move on the 3rd child window how cam we do ?

  • @smiley1163
    @smiley1163 2 ปีที่แล้ว +1

    Hi sir,
    I have tried using this concept in opening a banking site. I'm getting titles of all windows. What should I do to avoid getting handle of parent window. Can u help me sir

    • @HYRTutorials
      @HYRTutorials  2 ปีที่แล้ว

      Didn't get your question buddy.
      Can u rephrase the question?

  • @akhilnandu5199
    @akhilnandu5199 2 ปีที่แล้ว +1

    hi bro nanu program rasanu two tabs open avvali and second tab(child tab) open ayyena taruvata parent tab close avvali... driver.quit(); use cheysanu ayeena raaleydhu bro....driver.findElement(By.cssSelector("[alt=''])"));...alt taruvata em mention cheyyali...

    • @HYRTutorials
      @HYRTutorials  2 ปีที่แล้ว

      Open chesina anni windows close avvali ante driver.quite use cheyyali but only one window close avvali ante apdu focus aa window loki teeskelli driver.close method use cheyyali buddy

  • @hardeepkaur228
    @hardeepkaur228 2 ปีที่แล้ว +1

    In the link that you provided, when I click on open multiple tabs , then only one tab gets opened, Same is the case with window, only one window gets opened when I click on open multiple windows. Why is this so ????

    • @HYRTutorials
      @HYRTutorials  2 ปีที่แล้ว +1

      By default your browser might be blocking the popup windows.
      Change the popup settings in your browser buddy

  • @arreddypala5058
    @arreddypala5058 2 ปีที่แล้ว +2

    While practicing on hyr practice page( window handle practice page)
    When I want to click on "open new tab window". I wrote a code for it. When I run , browser starts and goes the specific page and not clicking on desired element. ***unexpected popups ads*** are appearing which are stopping the script from execution.
    How to handle this situation?

    • @HYRTutorials
      @HYRTutorials  2 ปีที่แล้ว

      Try to open the webpage directly with its URL.
      I think u r hovering on the menu and then clicking on the desired page ryt?

    • @arreddypala5058
      @arreddypala5058 2 ปีที่แล้ว +1

      @@HYRTutorials no sir, directly I am opening the page with its url. Previously I don't get any advertisement popups in selenium.. This time I am facing this issue. This is the problem facing with other applications also.

    • @HYRTutorials
      @HYRTutorials  2 ปีที่แล้ว

      @@arreddypala5058 every add window will be present inside the frame so try to handle that and close it.

    • @arreddypala5058
      @arreddypala5058 2 ปีที่แล้ว

      @@HYRTutorials if n number of frames appear on page.how to handle them. They are not having any frame tag to identify

    • @HYRTutorials
      @HYRTutorials  2 ปีที่แล้ว

      @@arreddypala5058 if it doesn't have frame tag then it is not a frame buddy

  • @bareen3276
    @bareen3276 ปีที่แล้ว

    nyc explanation

  • @HemaBishtThakur
    @HemaBishtThakur ปีที่แล้ว +1

    Hello… there are two handles, so we easily can switch to parent handle. What if we have 3-4 handles? How can we switch to 2 or 3 window handle?

    • @gangasreenivasakumarreddy713
      @gangasreenivasakumarreddy713 11 หลายเดือนก่อน +1

      Please explain the video for handling 2 or 3 windows

    • @HYRTutorials
      @HYRTutorials  11 หลายเดือนก่อน

      It doesn't matter how many videos are there buddy. You can always switch to any window you want based on its title.
      Initially you should store your parent window in one variable so that you can use it for later use.

  • @gouryraj381
    @gouryraj381 2 ปีที่แล้ว +1

    Sir ,i didn't get the difference between window and tab, as they both looks similar??

    • @HYRTutorials
      @HYRTutorials  2 ปีที่แล้ว +1

      To automation, they both are same buddy.

  • @thetruth5672
    @thetruth5672 ปีที่แล้ว +1

    Nice explanation sir, but does Set interface maintains the insertion order?

    • @HYRTutorials
      @HYRTutorials  ปีที่แล้ว

      Set interface is implemented by many classes buddy. So each one of those implementation is different. Some provide hashing mechanism and some provide sorting mechanism and so on.
      So if you learn about them then u will understand which is used for what purpose

  • @yeliza2350
    @yeliza2350 2 ปีที่แล้ว +1

    Thank you Yadagiri 💫28 February

    • @HYRTutorials
      @HYRTutorials  2 ปีที่แล้ว

      u have already watched more than 10 videos now, so try to spend some time for practice as well

  • @vamsikuna7273
    @vamsikuna7273 หลายเดือนก่อน

    Hi Reddy sir i have written in same code but my application is not running..........

  • @hemangishelake9849
    @hemangishelake9849 3 ปีที่แล้ว +2

    Do you have any paid courses for the framework? I would like to enroll

    • @HYRTutorials
      @HYRTutorials  3 ปีที่แล้ว +4

      No Hemangi,
      Everything is free in my channel.
      On framework I haven't uploaded any videos yet.
      I'm not getting time to make those videos but i will make them very soon.

    • @abdulrahaman176
      @abdulrahaman176 3 ปีที่แล้ว

      @@HYRTutorials Thank you so .... much Really looking for your framework design videos👍😊

  • @gilsonsouza8159
    @gilsonsouza8159 3 ปีที่แล้ว +1

    Hi! I am not able to switch to the third window! Actually my issue is that my automation is opening 3 windows in different times. So I don't know when and witch command should I use to move to the third window

    • @HYRTutorials
      @HYRTutorials  3 ปีที่แล้ว +1

      At different times means just seconds or minutes?

    • @gilsonsouza8159
      @gilsonsouza8159 3 ปีที่แล้ว

      ​@@HYRTutorials Seconds!
      The procedure is:
      1- open a window, type something, press enter. It will open another window.
      2- (I am able to get in the second window) in the second window, I click in the icon "edit", than it opens another window.
      3- (I am not able to get in the third window) in this window I am supposed to perform some actions.
      4- after perform the actions, I need to comeback to the parent window (that is not a problem, since I know how to do that.)
      So the biggest issue, is in the steep 3.
      Please give some light on that! :)

    • @HYRTutorials
      @HYRTutorials  3 ปีที่แล้ว +1

      @@gilsonsouza8159 in the second window before you click on edit, how many window handles u r getting?
      And after clicking on edit button, how many window handles u r getting?

    • @gilsonsouza8159
      @gilsonsouza8159 3 ปีที่แล้ว +1

      ​@@HYRTutorials Hi, Thank you for your support on this!
      in the second window before you click on edit, how many window handles u r getting?
      2 windows:
      CDwindow-C2EF12C82997362E16DA96D182596371,
      CDwindow-9EB029E8E620C2421412D453B68B627B
      And after clicking on edit button, how many window handles u r getting?
      3 Windows:
      [CDwindow-C2EF12C82997362E16DA96D182596371,
      CDwindow-9EB029E8E620C2421412D453B68B627B,
      CDwindow-A4BE466850893E0169EBC6334028FB60]

    • @HYRTutorials
      @HYRTutorials  3 ปีที่แล้ว +2

      so now it's clear that we are getting the window handle properly but somehow it is going wrong in the window switching part.
      Please make sure you are switching to the third window correctly.
      in the above case, CDwindow-A4BE466850893E0169EBC6334028FB60] is the window handle of the third window.
      try implementing some logic to identify the third window handle correctly so that the task will be done perfectly without any issues.
      and one more important thing is if you are switching to the third window correctly and still you are unable to perform the operations on the desired elements then make sure that the element is not present inside any frame.
      if it is present inside any frame then u need to handle the frame as well.

  • @sureshbabukusuma1952
    @sureshbabukusuma1952 11 หลายเดือนก่อน +1

    i am confused for multiple windows can you please help me i am out of my mind how to switch to second child window

    • @HYRTutorials
      @HYRTutorials  10 หลายเดือนก่อน

      Which part is exactly confusing buddy? Getting any errors?

  • @manikantachitirala9509
    @manikantachitirala9509 ปีที่แล้ว

    can you do a video on window handling using collections(by using Iterator)

    • @HYRTutorials
      @HYRTutorials  ปีที่แล้ว +1

      If you know how to iterate a set using an iterator then the same thing you can apply here buddy

  • @kumarbh1145
    @kumarbh1145 2 ปีที่แล้ว +1

    for (String handle :handles ) can u explain me once ,why its come

    • @HYRTutorials
      @HYRTutorials  2 ปีที่แล้ว

      Adi for each loop and andulo use chesina handles anedi set.
      Manam aa collection ni iterate cheyyadam kosam foreach loop ni use chesthunnam.

  • @softwareengineering6111
    @softwareengineering6111 3 ปีที่แล้ว +1

    great

  • @roshanp.thomas1768
    @roshanp.thomas1768 2 ปีที่แล้ว +1

    Hi..if two windows are opened along with the parent window..how it will identify..we are giving handle only na...and we want to pass the value to one window only..in this case..can you pls show one eg.

    • @HYRTutorials
      @HYRTutorials  2 ปีที่แล้ว +1

      Basically selenium doesn't keep a track like parent window or child window.
      It is our job to identify which is parent and which one is child.
      Accordingly we have to implement our logic.
      Selenium can handle one window at any given point of time.
      That is why if we want to perform operations on any other window, we need to switch our focus to that window. Then only we can perform the operations

    • @roshanp.thomas1768
      @roshanp.thomas1768 2 ปีที่แล้ว

      @@HYRTutorials how to switch focus to the second child window in program..do you have any eg..

    • @HYRTutorials
      @HYRTutorials  2 ปีที่แล้ว

      @@roshanp.thomas1768 I have shown that in the video ryt?
      Did u watch the video bro?

    • @roshanp.thomas1768
      @roshanp.thomas1768 2 ปีที่แล้ว +1

      @@HYRTutorials can you please share the link

    • @HYRTutorials
      @HYRTutorials  2 ปีที่แล้ว

      @@roshanp.thomas1768 th-cam.com/video/InTZhbAWCrU/w-d-xo.html

  • @user-fn7ol6bj1n
    @user-fn7ol6bj1n 9 หลายเดือนก่อน

    Please help I want to open new tab, than closed this tab after switch to old tab🙏

    • @user-fn7ol6bj1n
      @user-fn7ol6bj1n 9 หลายเดือนก่อน

      Thank for your video all work

  • @N.raju8247
    @N.raju8247 ปีที่แล้ว +1

    How to uncomment code what is short cut key for this

    • @HYRTutorials
      @HYRTutorials  ปีที่แล้ว

      You can use Ctrl+7 for commenting and uncommenting.
      Watch this video for more information on the same
      th-cam.com/video/Tg_brasnNsU/w-d-xo.html

  • @sravanthisravs3480
    @sravanthisravs3480 ปีที่แล้ว +1

    Thank you so much for the nice explanation. Your way of explanation made me understand the concept very easily..
    Spread your knowledge in the same way.. All the best 🙂

  • @4_kingsgamers647
    @4_kingsgamers647 ปีที่แล้ว +1

    @H Y R Tutorials I have run Program according to your method Sir, but there its showing an exception on click();
    Please help me Sir....😊

    • @HYRTutorials
      @HYRTutorials  ปีที่แล้ว

      What is the exception buddy?

    • @4_kingsgamers647
      @4_kingsgamers647 ปีที่แล้ว +1

      @@HYRTutorials org.openqa.selenium.ElementClickInterceptedException... This exception it's showing Sir

    • @HYRTutorials
      @HYRTutorials  ปีที่แล้ว

      Probably there is another element which is overlapping this element.
      Try to apply some scrolling and then click on the target element buddy

  • @prashanthlakavath3918
    @prashanthlakavath3918 2 ปีที่แล้ว +1

    Hi...I am unable to take membership for new batch November selenium Java... request is failing Everytime... please make membership easy to subscribers

    • @HYRTutorials
      @HYRTutorials  2 ปีที่แล้ว

      Thats not handled by me buddy. its completely taken care by youtube itself.
      Try using any UPI payment method. You can get lot of videos on that process in youtube buddy

  • @gilsonsouza8159
    @gilsonsouza8159 3 ปีที่แล้ว +1

    Hi man! here I am again kkkkkkkk
    I have a question for you.
    I want to know if it is possible to identify a word inside of a text. And using selenium, I want to change this specific word to another one.
    Scenario: I have hundreds of knowledges bases outdated because of one word.
    e.g.:
    Outdated : HYR is the best channel in "INDIA"
    Outdated : HYR office is located in "INDIA"
    Outdated : HYR has received the Nobel Prize, his country, "INDIA", is in a good position now.
    then I need to change the specific word "INDIA" into "THE WORLD" , of course it will be out of context, it is just to introduce to you the context.
    Updated : HYR is the best channel in "THE WORLD"
    Updated : HYR office is located in "THE WORLD"
    Updated : HYR has received the Nobel Prize, his country, "THE WORLD", is in a good position now.
    can you help me with that? do you know if it is possible? I didn't find any content about this yet
    Thank you so much!

    • @HYRTutorials
      @HYRTutorials  3 ปีที่แล้ว +1

      Did you try the replace method?

    • @gilsonsouza8159
      @gilsonsouza8159 3 ปีที่แล้ว +1

      @@HYRTutorials Uauuuuuu! there you go again!!! I just searched for this method and it fits perfect in what I am looking for.
      Thank you so much!!!
      do you have any course to indicate?

    • @HYRTutorials
      @HYRTutorials  3 ปีที่แล้ว

      That's good to hear ☺️
      Course regarding?

  • @kmaheshbabu3988
    @kmaheshbabu3988 3 ปีที่แล้ว +1

    Anna mouse hover effect gurinchi oka video cheyyandi plsss.....

    • @HYRTutorials
      @HYRTutorials  3 ปีที่แล้ว +1

      chesthunna bro, very soon upload chesthanu

  • @subramanyabhushan1637
    @subramanyabhushan1637 11 หลายเดือนก่อน +1

    cant reach the
    website

    • @HYRTutorials
      @HYRTutorials  10 หลายเดือนก่อน

      Which website buddy

  • @user-gt2fp8nx9y
    @user-gt2fp8nx9y หลายเดือนก่อน

    Prompt box not clicking sir

  • @shaikbajimunni2193
    @shaikbajimunni2193 ปีที่แล้ว +1

    plz increase the volume

    • @HYRTutorials
      @HYRTutorials  ปีที่แล้ว

      That's the maximum volume video has buddy. Can you check wether the TH-cam volume is low or mobile volume buddy

  • @nonu43db
    @nonu43db 2 ปีที่แล้ว

    Hi,
    When I run the code I have observed 2 things:
    1) driver.switchTo().window(parentHandle);
    driver.findElement(By.xpath("//input[@id='name']")).sendKeys("parent window");
    Textbox in first window I am printing text "parent window" got executed twice and print at the start and at the end again.
    giving me result like this in textbox "parent windowparent window"
    2) If I am writing Lastname in child window. It is showing me exception java.lang.NullPointerException

    • @HYRTutorials
      @HYRTutorials  2 ปีที่แล้ว

      Can you send me the code on hyadagirireddytutorials@gmail.com

  • @alokranjan168
    @alokranjan168 ปีที่แล้ว +1

    Only u have handled two windows

    • @HYRTutorials
      @HYRTutorials  ปีที่แล้ว

      Two is more than one buddy. For any number of windows the process is same

  • @varadarajud.h6301
    @varadarajud.h6301 ปีที่แล้ว +1

    Ur full speed not understanding

    • @HYRTutorials
      @HYRTutorials  ปีที่แล้ว

      Change the playback settings buddy

  • @monikaagnihotri5887
    @monikaagnihotri5887 3 ปีที่แล้ว +1

    Hi , I have used the same code on my system and tried to run same scenario but i am getting NoSuchElementException at child window "firstName" element. I think the first name field at child window is not accessible by code. Should I use scroll and then give the input?
    Exception in thread "main" org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"#firstName"}

  • @user-zi4vk3vv5w
    @user-zi4vk3vv5w หลายเดือนก่อน

    why can't you start udemy course and training institute, think as business.

  • @jatinsharma3792
    @jatinsharma3792 8 หลายเดือนก่อน

    Do not use this website It will waste your 2hr !!!!!!!!!!!!!!!!!!!!!!!!!!!

    • @beastfans_india
      @beastfans_india 8 หลายเดือนก่อน

      like i am not able use the click button not sure why ?