SGP Posted January 23, 2020 Share Posted January 23, 2020 Hi, I was trying to save XML opened in chrome new window,below is the code x.Send("{CTRLDOWN}{s}{CTRLUP}"); Thread.Sleep(5000); x.WinActivate("Save As", ""); x.WinWaitActive("Save As", "", 15); this code worked in IE browser but in Chrome Browser. Please help me to fix this Link to comment Share on other sites More sharing options...
Nine Posted January 23, 2020 Share Posted January 23, 2020 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Danp2 Posted January 23, 2020 Share Posted January 23, 2020 Hi SGP, "Doesn't work" isn't enough for us to go on. Please provide more details on you setup. 😉 P.S. It appears that you are trying to use AutoItX. Is that correct? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
SGP Posted January 27, 2020 Author Share Posted January 27, 2020 Hi Danp2, Yes i am using AutoItx3 to save xml window which is opened through chrome browser, below is the code i am trying to execute to save xml public static void Xmlsave(string RowNumber,string policy) { string currentURL = ObjectHandling.driver.Url; //string debugurl = currentURL.Replace("Quote", "api/v1/debug-product/" + PacketName("AA") + "/RawPacket"); string debugurl = currentURL.Replace("Quote", "api/v1/debug-product/AA/RawPacket"); Thread.Sleep(2000); //api / v1 / debug - product / AA / RawPacket ? SessionIndex = 0 ObjectHandling.driver.Navigate().GoToUrl("view-source:" + debugurl); string text = ObjectHandling.getTextFromElement("//table").Replace("\r\n", "").Replace(@"\""", @""""); ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(debugurl); myReq.UseDefaultCredentials = true; myReq.PreAuthenticate = true; myReq.Credentials = CredentialCache.DefaultCredentials; WebClient client = new WebClient(); client.Credentials = CredentialCache.DefaultCredentials; Stream data = client.OpenRead(new Uri(debugurl.Trim())); //Retrieve the text StreamReader reader = new StreamReader(data); string htmlContent = reader.ReadToEnd(); //myReq.GetResponse(); new WebClient().DownloadFile(debugurl, Program.filename + "\\" + RowNumber + ".xml"); Thread.Sleep(1000); AutoItX3 x = new AutoItX3(); x.MouseClick("left", 650, 475); Thread.Sleep(5000); x.Send("{CTRLDOWN}{a}{CTRLUP}"); x.Send("{CTRLDOWN}{s}{CTRLUP}"); Thread.Sleep(5000); x.ControlSetText("Save As", "","",Program.filename + "\\" + RowNumber + "_" + policy + ".xml"); x.ControlSetText("Save As", "", "[CLASS:Edit; INSTANCE:1]", Program.filename + "\\" + RowNumber + "_" + policy + ".xml"); x.WinActivate("Save As", ""); x.WinWaitActive("Save As", "", 15); x.Send(Program.filename + "\\" + RowNumber + ".xml"); Thread.Sleep(2000); x.Send("{Enter}"); x.Sleep(5000); ObjectHandling.driver.Navigate().GoToUrl(currentURL); } Link to comment Share on other sites More sharing options...
SGP Posted January 27, 2020 Author Share Posted January 27, 2020 Kindly help me out to fix this as i am new to this function Link to comment Share on other sites More sharing options...
Danp2 Posted January 27, 2020 Share Posted January 27, 2020 You still haven't explained where you code isn't functioning as expected. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now