Saturday, 19 April 2014

Handling Windows Dialogs Using Selenium Part4

This section describes some of the important API methods and their usage.


//The initial method to interact with a main window
public WindowElement getWindowElement(String windowName)
                     throws WindowsHandlerException


//To Check whether a particular window is present
public boolean isWindowPresent(String windowName) 


//To see whether an element is displayed on screen (Visible on screen)
public boolean isDisplayed(WindowElement element) 


//To determine whether an element is enabled to interact
public boolean isEnabled(WindowElement element)
                     throws WindowsHandlerException 


//To check whether an element is found
public boolean isNull(WindowElement element) 


//Retrieve Text Box Content
public String getTextBoxValue(WindowElement element)


//Get text of an Element
public String getText(WindowElement element)


//Search for Installed browser Version, Pass the Browser Enum as parameter
public String getInstalledBrowserVersion(Browser browser)
                     throws WindowsHandlerException 


//Start/Run/Open an application
public boolean openApplication(String appPath) 


//Close Process safely as a user would close it.
//Identify the process by id or multiple process by same name
//If the process cannot be closed in a natural way - kill the process
public void closeProcessesByName(String name, boolean forceKill)
public void closeProcessesByID(int pid, boolean forceKill)



//Search an element by following methods
public WindowElement findElementByAccessKey(WindowElement parentElement,
                     String accessKey) throws WindowsHandlerException


public WindowElement findElementByClassNameAndLocalizedControlType(
                     WindowElement parentElement, String className,
                     String localizedControlTypeName) throws WindowsHandlerException

public WindowElement findElementByAutomationID(WindowElement parentElement,
                     String automationID) throws WindowsHandlerException 

public WindowElement findElementByNameAndLocalizedControlType(
                     WindowElement parentElement, String name,
                     String localizedControlTypeName) throws WindowsHandlerException 

public WindowElement findElementByClassName(WindowElement parentElement,
                     String className) throws WindowsHandlerException

public WindowElement findElementByNameAndClassName(
                     WindowElement parentElement, String name, String className)
                     throws WindowsHandlerException


public WindowElement findElementByLocalizedControlType(
                     WindowElement parentElement, String localizedControlTypeName)
                     throws WindowsHandlerException

public WindowElement findElementByName(WindowElement parentElement,
                     String name) throws WindowsHandlerException 





Find Multiple Elements by
public List<WindowElement> findElementsByLocalizedControlType(
                     WindowElement parentElement, String localizedControlTypeName) 


To Be Contd..

124 comments:

  1. Your information about software testing is really interesting. Also I want to know the latest new techniques which are implemented in software testing. Can you update it in your website.

    ReplyDelete
    Replies
    1. IEEE Final Year Project centers make amazing deep learning final year projects ideas for final year students Final Year Projects for CSE to training and develop their deep learning experience and talents.

      IEEE Final Year projects Project Centers in India are consistently sought after. Final Year Students Projects take a shot at them to improve their aptitudes, while specialists like the enjoyment in interfering with innovation.

      corporate training in chennai corporate training in chennai

      corporate training companies in india corporate training companies in india

      corporate training companies in chennai corporate training companies in chennai

      I have read your blog its very attractive and impressive. I like it your blog. Digital Marketing Company in Chennai

      Delete
  2. Hi AT,

    Can i use regular expression for windowName in getWindowElement(String windowName)
    ex : getWindowElement("* - Windows Internet Explorer")

    Regards,
    Vinay

    ReplyDelete
    Replies
    1. Hello Vinay,

      Regular Expressions are not supported yet.

      #AT

      Delete
    2. Thanks for the reply, are there any plans in future?

      ~Vinay

      Delete
    3. please log your requests in the below page.

      https://docs.google.com/spreadsheet/ccc?key=0ArrZvkq9tkwPdEpfa0tFN0RIQ0ZyXy1mSGZPdzl4MVE&usp=drive_web#gid=5

      #AT

      Delete
  3. Hi AT,


    Through code i run the following :
    {{
    line1 : ffElement = handler.getWindowElement("Import Controls & Questionnaires - Mozilla Firefox");
    line2 : handler.setFocus(ieElement);
    line3 : WindowElement uploadElement = handler.findElementByName(ffElement ,"Choose File to Upload");
    line4 : WindowElement fileNamePath = handler.findElementByNameAndClassName(uploadElement, "File name:", "Edit");

    }}

    in the above code after line2 the dialog comes to the front at line3 i get the following error :
    {{
    [ATU Windows Handler Framework Exception] The Given Parent Element is null, Consider Checking the Parent Element's Identification parameters
    }}


    Using UISpy when i select "Set Focus" i get the following error :

    {{
    Exception
    Time Stamp:6/10/2014 8:01 PM
    Element:"window" "Import Controls & Questionnaires - Mozil..."
    Name:InvalidOperationException
    Message:Target element cannot receive focus.
    Stack Trace: at System.Windows.Automation.AutomationElement.SetFocus()
    at UISpy.Base.Node.SetFocus()

    }}

    though the element is present.

    Note : It is specific to one dialog, this code works fine on other dialogs. Not sure what attributes it is unable to find.


    Please let me know if you need any additional information using UISpy

    Appreciate your help.

    Regards,
    Vinay

    ReplyDelete
    Replies
    1. UISpy message indicates the element cannot receive focus. It is not necessary that UISpy must work on all the elements perhaps the developers of the Dialog may have restricted the element to be visible or the element is actually hidden and cannot receive focus - another element might be overlapping on this element (such as pane).

      #AT

      Delete
    2. Hi AT,

      Thanks for your kind reply.

      I tried to change the browser attributes and i was able to get the focus of all the elements in Upload Dialog box using UISpy, but when i run the java code i get the same error after executing line3 (code in my previous comments), if you notice line2 executes fine and the focus is set to the Browser.
      {{
      [ATU Windows Handler Framework Exception] The Given Parent Element is null, Consider Checking the Parent Element's Identification parameters
      }}

      Are there any specific attributes that handler.findElementByName looks for, if you could please tell me i will modify them and try again.

      Appreciate your help.

      Regards,
      Vinay

      Delete
    3. Vinay,

      "getWindowElement" is used to identify the main window (Parent window). In your code ""Import Controls & Questionnaires - Mozilla Firefox"" is this the name of the upload dialog ?

      If so, then first identify the Firefox browser main window using "getWindowElement", then try to find upload dialog.

      WindowHandler handler = new WindowHandler();
      WindowElement firefoxElement = handler
      .getWindowElement("Firefox Main Window name");
      WindowElement uploadDialog = handler.findElementByName(firefoxElement,
      "File Upload Dialog Name");

      #AT

      Delete
    4. Hi AT,

      I tried the same steps as you said, additionally i added another step to make sure the parent window is identified after
      -WindowElement firefoxElement = handler
      .getWindowElement("Firefox Main Window name");
      -handler.setFocus(firefoxElement );
      after executing this step the firefox window comes to the Front.
      and then after executing the below step the script fails with the exception Parent element is null
      -WindowElement uploadDialog = handler.findElementByName(firefoxElement,
      "File Upload Dialog Name");

      Regards,
      Vinay

      Delete
    5. Hi AT

      Thanks for your support, i just figured out the issue, it was caused because of special character '&' in the 'Name', i guess if you extend your support to accept special character it would be excellent.

      Regards,
      Vinay

      Delete
    6. Hi AT

      I have kind of question target element cannot receive focus but here am automating on excel using win32ole and RAutomation gem am using ruby and cucumber. Using win32 and msuia adapter for find the element here am attaching autoit window info
      >>>> Window <<<<
      Title:Book1 - Excel
      Class:XLMAIN
      Position:-9, -9
      Size:1938, 1050
      Style:0x17CF0000
      ExStyle:0x00010110
      Handle: 0x000908D4

      >>>> Control <<<<
      Class:ATL:66E99690
      Instance:6
      ClassnameNN:ATL:66E996906
      Name:Advanced (Class):[CLASS:ATL:66E99690; INSTANCE:6]
      ID:256
      Text:More>>
      Position:1656, 975
      Size:248, 20
      ControlClick Coords:30, 12
      Style: 0x56010000
      ExStyle:0x00000000
      Handle: 0x000C0

      Any workaround appreciated your help.

      Delete
  4. Thank you for sharing good information. I liked your blog, keep posting. I am from Indium software is an independent testing company that provides both Outsourced/In-house Manual & regression test automation testing services across the world. Testing & enhance the performance of your desktop, mobile or web application under load and stress.

    ReplyDelete
  5. I have the same problem
    [ATU Windows Handler Framework Exception] The Given Parent Element is null, Consider Checking the Parent Element's Identification parameters
    at atu.utils.windows.handler.WindowHandler.findElementByNameAndLocalizedControlType(WindowHandler.java:158)
    at com.seleniummaster.agent.ReportInfoCenter1.testTomcatAuthenticationInFirefox(ReportInfoCenter1.java:71)
    ...............................

    ReplyDelete
  6. we provide our valued clients a comprehensive portfolio of new age IT consulting services that streamline their process, help them manage change, innovate newer opportunities for maximizing profit and best of all assist build a credible brand.

    ReplyDelete
  7. Really awesome blog. Thanks for sharing this informative blog. Suppose if anyone want to learn Software Testing Training in Chennai at a reputed training institutes. If you are looking for best Software Testing Training Institutes in Chennai reach FITA located at Chennai, India. Rated as No.1 placement and training center in Chennai.

    ReplyDelete
  8. Hi, I wish to be a regular contributor of your blog. I have read your blog. Your information is really useful for beginner. I did QTP Training in Chennai at Fita training and placement academy which offer best Software Testing Training in Chennai with years of experienced professionals. This is really useful for me to make a bright career.

    ReplyDelete
  9. The future of software testing is on positive note. It offers huge career prospects for talented professionals to be skilled software testers. Automation training in Chennai | Software training | Software testing training institute Chennai

    ReplyDelete
  10. very nice !!! i have to learning a lot of information for this sites...Sharing for wonderful information.
    CCNA training in chennai | CCNA training chennai | CCNA course in chennai | CCNA course chennai

    ReplyDelete
  11. This site provides good information about mobile app testing. If anyone wants to know the basics of mobile app testing then this is the right blog for them. mobile application testing training in Chennai | mobile application testing training

    ReplyDelete
  12. Whatever we gathered information from the blogs, we should implement that in practically then only we can understand that exact thing clearly, but it’s no need to do it, because you have explained the concepts very well. It was crystal clear, keep sharing..
    Websphere Training in Chennai

    ReplyDelete
  13. Data warehousing Training in Chennai
    I am reading your post from the beginning, it was so interesting to read & I feel thanks to you for posting such a good blog, keep updates regularly..

    ReplyDelete
  14. Selenium Training in Chennai
    Wonderful blog.. Thanks for sharing informative blog.. its very useful to me..

    ReplyDelete
  15. Oracle Training in chennai
    Thanks for sharing such a great information..Its really nice and informative..

    ReplyDelete
  16. SAP Training in Chennai
    This post is really nice and informative. The explanation given is really comprehensive and informative..

    ReplyDelete
  17. This information is impressive..I am inspired with your post writing style & how continuously you describe this topic. After reading your post, thanks for taking the time to discuss this, I feel happy about it and I love learning more about this topic
    Android Training In Chennai In Chennai

    ReplyDelete
  18. Pretty article! I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing..
    Unix Training In Chennai

    ReplyDelete
  19. I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing..
    SalesForce Training in Chennai

    ReplyDelete
  20. There are lots of information about latest technology and how to get trained in them, like Best Hadoop Training In Chennai in Chennai have spread around the web, but this is a unique one according to me. The strategy you have updated here will make me to get trained in future technologies Hadoop Training in Chennai By the way you are running a great blog. Thanks for sharing this blogs..

    ReplyDelete
  21. This is really an awesome article. Thank you for sharing this.It is worth reading for everyone. Visit us:
    Oracle Training in Chennai

    ReplyDelete
  22. very nice blogs!!! i have to learning for lot of information for this sites...Sharing for wonderful information.Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing.Oracle DBA Training in Chennai

    ReplyDelete
  23. Wonderful tips, very helpful well explained. Your post is definitely incredible. I will refer this to my friend.SalesForce Training in Chennai

    ReplyDelete
  24. I have finally found a Worth able content to read. The way you have presented information here is quite impressive. I have bookmarked this page for future use. Thanks for sharing content like this once again. Keep sharing content like this.

    Software testing training in chennai | Software testing training | Software testing institute in chennai

    ReplyDelete
  25. Really awesome blog. Your blog is really useful for me. Thanks for sharing this informative blog. Keep update your blog.
    Oracle Training In Chennai

    ReplyDelete
  26. I am reading ur post from the beginning, it was so interesting to read & i feel thanks to you for posting such a good blog, keep updates regularly.Best Hadoop Training Institute In Chennai

    ReplyDelete
  27. very nice AT!!! Thanks for sharing such a nice information. Here i am stuck with an exception could you please help me out.
    Getting Error:
    [ATU Windows Handler Framework Exception] The Given Parent Element is null, Consider Checking the Parent Element's Identification parameters.

    Even though parent element is not null

    ReplyDelete
  28. Great discussion and inform on where is web design going in 2016. Each and every year web design is growing and plenty of innovative and impressive things are shared and published every day.design services

    ReplyDelete
  29. Thanks for sharing great information in your blog. Got to learn new things from your Blog . It was very nice blog to learn about Selenium.
    Selenium

    ReplyDelete
  30. Thanks a lot AT!! ,your blog is awesome, has got very valuable information. I got know more about how to identify windows objects which i was searching from long time. It solved my automation problem..

    ReplyDelete
  31. Well explained. Got to learn new things from your Blog on Appium.Appium training in chennai

    ReplyDelete
  32. Great efforts put it to find the list of articles useful for Selenium, Definitely will share the same to other forums.
    We are also one of the best sources to learn Selnium -Selenium training in Chennai | Best Selenium training institute in Chennai

    ReplyDelete
  33. It is amazing and wonderful to visit your site.Thanks for sharing this information,this is useful to me...
    Android Training in Chennai
    Ios Training in Chennai

    ReplyDelete
  34. Hi,
    Can anyone help me to handle WindowElements which has same attributes. That is both window elements are having same AutomationID and other attributes are also same.
    Appreciate your help.

    ReplyDelete
  35. Those guidelines additionally worked to become a good way to recognize that other people online have the identical fervor like mine to grasp great deal more around this condition.

    Best Java Training Institute Chennai

    ReplyDelete
  36. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.
    uipath training institute in chennai

    ReplyDelete
  37. This is excellent information. It is amazing and wonderful to visit your site.Thanks for sharing this information,this is useful to me...
    Embedded training in chennai | Embedded training centre in chennai | PLC Training institute in chennai

    ReplyDelete
  38. Hello, I read your blog occasionally, and I own a similar one, and I was just wondering if you get a lot of spam remarks? If so how do you stop it, any plugin or anything you can advise? I get so much lately it’s driving me insane, so any assistance is very much appreciated.

    Devops Training in Chennai

    ReplyDelete
  39. Thanks for one marvelous posting! I enjoyed reading it; you are a great author. I will make sure to bookmark your blog and may come back someday. I want to encourage that you continue your great posts.
    Devops training in tambaram"

    Devops training in Sollonganallur"

    Deops training in annanagar"

    Devops training in chennai"

    Devops training in marathahalli"

    Devops training in rajajinagar"

    Devops training in BTM Layout"

    ReplyDelete
  40. Very interesting blog which helps me to get the in depth knowledge about the technology, Thanks for sharing such a nice blog..
    Good discussion.
    Six Sigma Training in Abu Dhabi
    Six Sigma Training in Dammam
    Six Sigma Training in Riyadh

    ReplyDelete
  41. I simply wanted to write down a quick word to say thanks to you for those wonderful tips and hints you are showing on this site.
    safety course in chennai

    ReplyDelete
  42. I just needed to record a speedy word to express profound gratitude to you for those magnificent tips and clues you are appearing on this site.

    Software Testing Training in Chennai
    Software Testing Training
    QTP Training in Chennai
    Selenium Training in Chennai
    LoadRunner Training in Chennai

    ReplyDelete
  43. Thanks for your information, the blog which you have shared is useful to us.

    Education
    Technology

    ReplyDelete
  44. I simply wanted to write down a quick word to say thanks to you for those wonderful tips and hints you are showing on this site.
    python training in chennai
    java training in chennai

    ReplyDelete
  45. Expected to form you a next to no word to thank you once more with respect to the decent recommendations you've contributed here.
    iosh safety course in chennai

    ReplyDelete
  46. It is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.
    Java training in Chennai | Java training Institute in Chennai

    ReplyDelete
  47. Thanks for sharing this information, it helps me to learn new things. Continue sharing more like this.
    Data Science Training in chennai
    Data Science course in chennai

    ReplyDelete
  48. Awesome post. Really you are shared very informative concept... Thank you for sharing. Keep on
    updating...

    Technology
    securityguardpedia

    ReplyDelete
  49. Its a wonderful post and very helpful, thanks for all this information.
    Vmware Training institute in Noida

    ReplyDelete
  50. Great Post,really it was very helpful for us.
    Thanks a lot for sharing!
    I found this blog to be very useful!!
    Software testing training in Bangalore

    ReplyDelete
  51. Amazing article. Your blog helped me to improve myself in many ways thanks for sharing this kind of wonderful informative blogs in live. I have bookmarked more article from this website. Such a nice blog you are providing ! Kindly Visit Us @ Best Travels in Madurai | Tours and Travels in Madurai | Madurai Travels

    ReplyDelete

  52. Thank you for sharing the article. The data that you provided in the blog is informative and effective.
    Best Devops Training Institute

    ReplyDelete
  53. Thank you very much for this post I really appericate your efforts and if u want to know more about free background music kindly visit us

    ReplyDelete
  54. Langkah dimana para player hanya memberikan taruhan di permulaan permainan dan tidak perlu menjalankan tambahan chip lagi untuk permainan. Akan tapi pemain masih bermain dan menjalankan pemasangan taruhan di permainan tersebut.
    asikqq
    http://dewaqqq.club/
    http://sumoqq.today/
    interqq
    pionpoker
    bandar ceme terpercaya
    betgratis
    paito warna terlengkap
    syair sgp

    ReplyDelete

  55. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
    RPA using UI PATH Training in Electronic City

    ReplyDelete
  56. The information is worth thinking over. I am really thankful to you for posting this blog.
    Selenium Training in Chennai | Best Selenium Training in Chennai

    ReplyDelete
  57. Whatever we gathered information from the blogs, we should implement that in practically then only we can understand that exact thing clearly, but it’s no need to do it, because you have explained the concepts very well. It was crystal clear, keep sharing.. i Want to share Some data regarding the websphere training videos with free bundle videos is provided.

    ReplyDelete
  58. What you have written has helped me a lot. I was thinking where to get such useful information. I will visit your website for more such informative blogs.
    Software Testing Training in Chennai | Software Testing Training Institute in Chennai

    ReplyDelete
  59. Thanks for Sharing This Article.It is very so much valuable content. I hope these Commenting lists will help to my website
    best microservices online training

    ReplyDelete

  60. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.

    Top Angularjs Training in Chennai
    Top Java Training in Chennai
    Top Bigdata Hadoop Training in Chennai

    ReplyDelete

  61. Your very own commitment to getting the message throughout came to be rather powerful and have consistently enabled employees just like me to arrive at their desired goals.

    Best Angularjs Training in Chennai
    Best Java Training in Chennai
    Best Bigdata Hadoop Training in Chennai
    Best SAS Training in Chennai
    Best Python Training in Chennai
    Best Software Testing Training in Chennai

    ReplyDelete
  62. Hello Admin!

    Thanks for the post. It was very interesting and meaningful. I really appreciate it! Keep updating stuffs like this. If you are looking for the Advertising Agency in Chennai | Printing in Chennai , Visit Inoventic Creative Agency Today..

    ReplyDelete
  63. After going over a handful of the weblog articles on your internet site, I really respect your method of writing a weblog. I bookmarked it to my bookmark webpage listing and might be checking lower back in the near destiny. Please test out my website as well and let me understand what you web watched.

    ReplyDelete
  64. Thanks for sharing such a great information..Its really nice and informative...
    Software Testing Course in Bangalore

    ReplyDelete
  65. I have been searching for a useful post like this on salesforce course details, it is highly helpful for me and I have a great experience with this Salesforce Training who are providing certification and job assistance. Salesforce CRM training in Noida

    ReplyDelete
  66. Gone through this wonderful coures called Salesforce Certification Training in Dallas who are offering fully practical course, who parent is Salesforce Training in USA and they have students at Salesforce Training classes in Canada institutes.

    ReplyDelete
  67. With special privileges and services, UEFA BET offers opportunities for small capitalists. Together ufa with the best websites that collect the most games With a minimum deposit starting from just 100 baht, you are ready to enjoy the fun with a complete range of betting that is available within the website

    ufabet , our one another option We are a direct website, not through an agent, where customers can have great confidence without deception The best of online betting sites is that our Ufa will give you the best price

    ReplyDelete
  68. INTELLIGENT SERVICE DESK - IMPROVING EMPLOYEE EXPERIENCE
    Service desks and self-service ticketing are ideal for the healthcare industry, and they have proven to be very successful. Healthcare institutions should implement automated platforms to maximize the benefits of healthcare for patients, doctors, and administrators.

    Learn More: Conversational AI service desk |

    ReplyDelete
  69. Get trained on data science course in hyderabad by real-time industry experts and excel your career with Data Science training by Technology for all. #1 online training institute for Data Science.

    ReplyDelete
  70. Very Nice Blog…Thanks for sharing this information with us. Here am sharing some information about training institute.
    best tableau online training in hyderabad

    ReplyDelete
  71. Finish the Python Training in Chennai from Infycle Technologies, the best software training institute in Chennai which is providing professional software courses such as Hadoop, Big Data, Android, and iOS Development, Data Science, Artificial Intelligence, Java, Oracle, etc with 100% hands-on practical training. Call 7504633633 to get more info and a free demo and to grab the certification for having a peak rise in your career.

    ReplyDelete