how to use runtime.getruntime.exec from Java in c#? RRS feed

  • Question

  • Hi guys, I'm desperate! :)

    I'm using Selenium for automation and I get stuck with <g class="gr_ gr_219 gr-alert gr_gramm gr_inline_cards gr_disable_anim_appear Grammar only-ins doubleReplace replaceWithoutSep" data-gr-id="219" id="219">window</g>(authentication required). So, now I'm using AutoIt to pass it with a Script but the only solution that I have found was in Java that uses runtime.getruntime.exec to pass the path from the script. So, I'm looking for a solution in c# equivalent to it.

     this <g class="gr_ gr_580 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del" data-gr-id="580" id="580">id</g> what <g class="gr_ gr_598 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" data-gr-id="598" id="598">im</g> <g class="gr_ gr_638 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar only-ins replaceWithoutSep" data-gr-id="638" id="638">trying</g> implement:

     Step2-Write the below program and Save the program.
    $title= "Authentication Required"
    send("<g class="gr_ gr_635 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" data-gr-id="635" id="635">sudheer</g>")

    Step3- Compile the Script which generates the .exe file.
    Step4-Execute the Script
    Step5- Implement this selenium.
    Runtime.getRuntime().exec("Absolute path to the https autoit script ");

    I tried this too, no luck :(

                            AutoItX3 autoIT = new AutoItX3();
                            String browser = driver.GetType().ToString();
                            switch (browser)
                                case "chrome":
                                    autoIT.WinActivate("Authentication required");
                            get alert here
                            IAlert alert = driver.SwitchTo().Alert();
                            alert.SendKeys("datainnovationsys" + Keys.Tab);
                            alert.SendKeys("Fr)N7TMFY3" + Keys.Enter);

    I really appreciate any help!!! 

    • Moved by Fei Hu Wednesday, February 7, 2018 9:26 AM Thirdparty libs related
    Wednesday, January 31, 2018 3:52 PM

All replies

  • Hello,

    Please edit your post and to remove the word processing tags. I suggest writing your question without using a word processor.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Wednesday, January 31, 2018 4:47 PM
  • Hello Alê_Bonfim,

    The selenium is more related to third party technology, you need to repost a new thread to selenium forum for better solution and professional support.

    If you have some grammar or code errors, please feel free to contact us. We will try our best to give you a solution.

    Best Regards,

    Neil Hu

    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, February 7, 2018 9:25 AM