Jump to content

AutoitX not working, Trend and possible alternatives?


frankh
 Share

Recommended Posts

  • Administrators

Note, I have no idea who created that nuget package - it wasn't us. I have no idea what it does.

There is no need to regsvr the dll - that is not used in C#.  Just the below is required:

The AutoItX3.Assembly.dll reference should be marked as "copy if newer" and the two other files - AutoItX.dll and AutoItX_x64.dll  - should be added to the root of the project and also marked "copy if newer". Then all these files should end up in your output folder. Try running the example from the code from the helpfile to ensure it's working correctly

        static void Main(string[] args)
        {
            // Wow, this is C#!
            AutoItX.Run("notepad.exe", "", 1);
            AutoItX.WinWaitActive("Untitled");
            AutoItX.Send("I'm in notepad");
            IntPtr winHandle = AutoItX.WinGetHandle("Untitled");
            AutoItX.WinKill(winHandle);
        }

I really need to add an example project to the installer for this...

Link to comment
Share on other sites

frank. What you need is to use Coded UI project. No auto IT necessary and it will record everything you do in C-sharp even your web log on. there isn't anything it can't do with MS UI Automation.

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

You misunderstand. you asked for alternative, CODED UI (available as a project type in VS 2015 Enterprise)

I don't have time or inclination to fix your Windows Environment for you.

shit doesn't just stop working for no reason. just because you can't find the change (needle in a HUGE haystack) don't think nothing has changed! MISTAKE number one.

In my 30+ yrs experience as a programmer, when stuff just stops, it's usually due to some change. I wish you best luck from here out. Noted that you appear to not be willing to participate in the troubleshooting, just sit there and complain about it.

Ask yourself this, What can I do about this? and start testing. Does the example I post work for example? You probably didn't even read my other posts. You obviously are a noob because you don't even know that C# can do ANYTHING, AutoIt can't comparing languages. Your first--rude comment to me suggests that you know little C#. fo

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

No need to be angry. I misread you, sorry. Claiming I'm not interested in troubleshooting is just silly, since that's what I've been asking about all the time. Of course there is a reason for things not working, but my point is that I haven't made any changes, AND there's not been any Windows updates between the afternoon when it was working and the morning after when it suddenly (after a reboot) wasn't.

I haven't used Coded UI before, because I wanted a solution which could be used in both VS and Eclipse. But in the name of pragmatism, I'll probably have to try it now. Thanks for that tip.

However, the challenge here is that Coded UI is a test project type. I'm have a pretty extensive framework where I use one Unit Test project and several class library project for automation. I have no automation code in the unit tests themselvs; They all use classes from the other projects. I cannot rewrite the entire framework.

Jon: Thanks for that. However, I have been using AutoItX extensively for allmost a year, so it's not in any way a question of how to use it, or how to set it up. The problem is that it suddenly stopped working on my computer alltogether, both in C# and Java. And the only thing that happened between it working and not was a night and a reboot.

Edited by frankh
Link to comment
Share on other sites

Ok, this is getting a bit different from what I thought. The problem now seems to be that it takes a long amount of time before AutoItX does anything.

Here's the situation:

I have the following:
- 1 VS project (unit tests and class libraries) that uses Selenium Webdriver for browser automation and AutoItX for handling the site login, file upload dialogs etc. This has been unchanged the last 3 days, and was not changed between when AutoItX worked and stopped working.
- 1 Java project doing the exact thing as the VS project, using AutoItX for Java.
- 1 stand-along winforms application that uses Selenium for spawning a Chrome browser session and AutoItX for logging in. That's it. This is a compiled application which has been unchanged for several months.

One afternoon all these were working. Then, the next morning I had to reboot the Win10 computer they're on. And then AutoItX seemingly stopped working. It's loading fine in both VS/C# and Eclipse/Java, and there are no error messages. But when the Chrome session is started, the username/password is simply not entered in the login prompt. Eventually it times out, but that's Selenium timing out.

To troubleshoot, I created a new C# Windows Console project in VS, and implemented AutoItX to open Notepad and type a line. And it works fine.

When I - in the same project - use Selenium Webdriver to spawn a browser window and enter my site with the login prompt, it's the same as with the other projects/application.

However, since the other project have a one minute timeout, I didn't notice something important: It works, but it takes more than one minute!

That is: From the browser is spawn and the login prompt is accessible, it takes more than a minute before AutoItX enters the text strings into the fields. Until recently, this has happened immediately.

This is the code that's been working smoothly for almost a year:

           
// Simplified use of Selenium Webdriver:
Instance.Navigate().GoToUrl("http://my.url.com");
// Access the login prompt and enter username password, then hit ENTER:
AutoItX.WinActivate("Authentication required");
AutoItX.Send(username);
AutoItX.Send("{TAB}");
AutoItX.Send(password);
AutoItX.Send("{TAB}");
AutoItX.Send("{ENTER}");

Here's the login prompt. No changes have been made there either.

image.png.cae74093157c72eb0f8ed059cdb45b45.png

 

The only difference between when I'm opening Notepad and opening Chrome is that Notepad is opened and accessed by AutoItX, while Chrome is opened by Selenium and (attempted to be) activated and accessed by AutoItX. But that's the way it's been for as long as I've used AutoIt (I've actually never used it outside my Selenium projects until now.)

I've tried using ControlSend instead of send, but I'm not getting a different result there. Also, the AutoIt Window Info app claims that the control (the login prompt) doesn't have an ID.

Besides: The cursor is blinking inside the text entry field - how come AutiItX waits more than a minute before doing anything?!

UPDATE: This doesn't seem to be an AutoIt issue at all. It just tried using System.Windows.Forms' SendKey() method, to send text to the currently active control. And the exact same thing happens. And the same goes for other login forms on other websites.

Edited by frankh
Link to comment
Share on other sites

4 hours ago, frankh said:

AND there's not been any Windows updates between the afternoon when it was working and the morning after when it suddenly (after a reboot) wasn't.

When was the last Windows Update applied? Also, can you run AU3Info and show us the properties of this authentication window?

Edited by Danp2
Link to comment
Share on other sites

no, NOTHING changed dude. it all worked but after reboot, and nothing changed. Let me tell you, LOTS changes every time you reboot, especial as software updates itself. Chrome auto updates too., as does MS apps and windows defender stuff. Corporate pushes policy changes, etc. SOMETHING changed! Quit the 'nothing changed' crap.

You can tell us nothing changed when you buy SysTracer Pro, snapshot the system when it was working and again when it wasn't to compare the changes to everything in the system. You can't do that. Stop repeating the nonsense, it's not true

you need to test on another working development system and see if they also have the issue to rule out your machine as the culprit if possible.

HINT, use VMs as your development systems, that way you can snapshot good images and roll back if shit goes south. I recommend VMware Workstation (Latest) or better

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

another thing you can do is analyze all t the *.log and *.txt files in your %temp% directory (use the MSI analyzer)  to see if there were any errors in anything that got installed. The WLogUtil,exe will tell if if there were errors in any given install of various system components.

another thing, go through all your pc system logs to see if there are problems in general with your pc (or have your IT guys do it)

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

Earthshine: I'm not interested in participating in the aggressive way of communicating. I'm just going to repeat myself, saying that "nothing changed" implies that nothing in the code or applications (that I've written) has been changed. Ok? Should be pretty clear, and also obvious that something has changed, somewhere.

DanP2:

>>>> Window <<<<
Title:    opusauth-tcopus-lab.dn13.no.tconet.net/?returnTo=http%3A%2F%2Fmy-lab-drop2.telecomputing.com%2F%3Fthisisadummy%3Dyesiam%26useSsl%3DFalse&rq=KWCUMKSVQLUQ2P3VGQQWA99KHBTLRHCMEQZ7AFZM4RXGBHXJ8LNQ - Google Chrome
Class:    Chrome_WidgetWin_1
Position:    10, 10
Size:    1050, 805
Style:    0x16CF0000
ExStyle:    0x00000100
Handle:    0x0055153C

>>>> Control <<<<
Class:    Intermediate D3D Window
Instance:    1
ClassnameNN:    Intermediate D3D Window1
Name:    
Advanced (Class):    [CLASS:Intermediate D3D Window; INSTANCE:1]
ID:    
Text:    
Position:    0, 0
Size:    1036, 798
ControlClick Coords:    575, 121
Style:    0x58000000
ExStyle:    0x00000004
Handle:    0x00A11026

>>>> Mouse <<<<
Position:    592, 131
Cursor ID:    0
Color:    0xFBFBFB

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
Chrome Legacy Window


>>>> Hidden Text <<<<
Chrome Legacy Window

Edited by frankh
Link to comment
Share on other sites

it's obvious that it's your machine by now. I've given you plenty of things you can do to check the health of your environment. hopefully you will find the culprit. Some update, or AV or something is messing with your environment, and, you may be powerless to change that, but I think, if it still works good on another computer or VM, then you should be OK as you can reimage your machine and get your dev software reinstalled.

Sorry, I get that nothing changed stuff so often--sorry to take that out on you. Promise I will try to let that go. Most times, I get it, someone does something and they don't want anyone to know, like they are going to get in trouble, so they come and tell me nothing changed and all too often things don't go too well, lots of wasted time, etc..

There are also free applications you can run while testing your system to see where all the resources are getting chewed up. The Performance Monitor can tell you what's going on in CPU, DISK, MEM, etc.. See where stuff is hanging up.

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

6 hours ago, frankh said:

UPDATE: This doesn't seem to be an AutoIt issue at all. It just tried using System.Windows.Forms' SendKey() method, to send text to the currently active control. And the exact same thing happens. And the same goes for other login forms on other websites.

That's good to know. Now you just need to figure out why this has occurred. Nothing we can do to help with that. ;)

 

Link to comment
Share on other sites

https://www.google.com/search?q=System.Windows.Forms'+SendKeys()+method+is+very+slow&hl=en&sa=X&as_q=&nfpr=&spell=1&ved=0ahUKEwiDvtDfifHZAhWRTd8KHUTXBxIQvwUIEQ

I wonder if the OP disabled UAC if the performance would come back? seems to be an issue when it's on.

 

 

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

Looking at my NuGet packages, I AM apparently using 32bit:

Selenium.Chrome.WebDriver by jbaranda
Selenium Chrome WebDriver (Win32)

I removed the nuget package, downloaded the latest Win32 nuget package from the Selenium website, added it an installed. No change.

Edited by frankh
Link to comment
Share on other sites

Try turning off the 'Automatically detect settings' in Chrome under Chrome:settings->Advanced->System->Open Proxy Settings (it just brings up your Internet Properties, then click LAN Settings button and try unchecking that setting. see if it makes stuff faster.

Capture.PNG.1041a7be5d044db3df3fbb0f08bc10cf.PNG

or do it in code. something like

https://sqa.stackexchange.com/questions/13919/selenium-webdriver-for-chrome-too-slow

 

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...