Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CalculatorTest.java failing while trying to execute the script remotely #12

Open
ashish9308 opened this issue Sep 12, 2017 · 4 comments

Comments

@ashish9308
Copy link

Hello Friend,

I'm very happy because you have developed a very useful thing.I want to use this AutoItDriverServer for remote execution (CalculatorTest.java ) but getting error while running from hub can you please tell me why it is failing.
I have done the primary setup in our client machine my server.py is running and through hub I'm trying to execute this sample script.

@daluu
Copy link
Owner

daluu commented Sep 12, 2017

If you're trying to run the server as a node under Selenium Grid, sorry my friend, the project doesn't currently support that. It just works standalone RemoteWebDriver mode only at the moment. I should make that more clear in the docs.

And see issue #7 for ideas how you can hook this server up as a node into Selenium Grid and requesting for this node in your tests. It requires some work to implement.

If you have issues with the standalone RemoteWebDriver mode, please provide the errors you're getting and I'll look into it.

@ashish9308
Copy link
Author

Hello Daluu,
As you have suggested (https://gist.github.com/daluu/3b4746f6b672c49f7e8f).I was trying this approach and to execute the selenium script and AutoIt script in server machine.
Till extract hostname I'm getting hostname like : 10.90.67.190

And after that I have modified the case 5 like :
DesiredCapabilities autoitCapabilities = new DesiredCapabilities();
autoitCapabilities.setCapability("browserName", "AutoIt");
WebDriver autoitDriver = new RemoteWebDriver(new URL("http://"+nodeHost+":4723/wd/hub"), autoitCapabilities);
System.out.println("Open Calculator");
autoitDriver.get("calc.exe");
Thread.sleep(4000);
autoitDriver.switchTo().window("Calculator");
Thread.sleep(1000);
System.out.println("Start Operation");
autoitDriver.findElement(By.id("139")).click(); // 3
Thread.sleep(1000);

It is working fine till printing Start Operation but after that it is failing and i'm getting error like :

Exception in thread "main" org.openqa.selenium.WebDriverException: AutoIt failed to click element [ID:139].
Command duration or timeout: 20 milliseconds

Please help me to resolve this issue. I need this urgently.

Thanks and Regards,
Ashish

@daluu
Copy link
Owner

daluu commented Sep 15, 2017

Sorry for the delay. That error tells you it failed to click or find that element based on the code

raise Exception("AutoIt failed to click element %s." % element)

I haven't inspected with an object identifier tool like AutoIt spy tool, but are you sure you have the right ID or do you have a typo? Unless it changed between Windows versions, for Windows 7 at least the ID for button 3 is 133.

@bindupatnaik
Copy link

Hi daluu,
I have cloned the repo and am trying to execute the calculator.py. I have done following steps
-installed AutoIT 3.3.14.5 version
-registered the AutoItX3.dll and AutoItX3_x64.dll( installed Python 32bit to avoid exceptions)
-ran the server.py using the command "python server.py -a 127.0.0.1 -p 9050 -c autoit_options.cfg"
-make sure the server is listening on port 9050.
-but when i run calculator.py i am getting
++++++++++++++++++++++
Desired Capabilities returned by server:

{'version': '0.1', 'browserName': 'AutoIt', 'platform': 'WINDOWS', 'takesScreenshot': False, 'caretCoordMode': '1', 'expandEnvStrings': '0', 'mouseClickDelay': '10', 'mouseClickDownDelay': '10', 'mouseClickDragDelay': '250', 'mouseCoordinateMode': '1', 'sendAttachMode': '0', 'sendCapslockMode': '1', 'sendKeyDelay': '5', 'sendKeyDownDelay': '5', 'winDetectHiddenText': '0', 'winSearchChildren': '0', 'winTextMatchMode': '1', 'winTitleMatchMode': '1', 'winWaitDelay': '250'}

Traceback (most recent call last):
File "C:\Temp\AutoItDriverServer\sample-code\calculator.py", line 17, in
driver.find_element_by_id("133").click() # 3
File "C:\Program Files (x86)\Python36-32\lib\site-packages\selenium\webdriver\remote\webelement.py", line 80, in click
self._execute(Command.CLICK_ELEMENT)
File "C:\Program Files (x86)\Python36-32\lib\site-packages\selenium\webdriver\remote\webelement.py", line 628, in _execute
return self._parent.execute(command, params)
File "C:\Program Files (x86)\Python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 320, in execute
self.error_handler.check_response(response)
File "C:\Program Files (x86)\Python36-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: AutoIt failed to click element None.
++++++++++++++++++++++++++
can you tell me if you faced similar prob?

Mine is
Win7- Python 3.6.4

I am trying to automate Desktop applications using python. Any kind of help is much appreciated. if you can point me to any kind of resources is much helpful.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants