GithubHelp home page GithubHelp logo

Comments (14)

daluu avatar daluu commented on June 14, 2024

Please clarify "I did start my selenium grid and hub" as in explain/list out the exact steps you did.

AutoItDriver(Server) does not work with Selenium Grid (registering to grid hub as a node), there is a way to do that, but I have not documented it yet, nor have I had the time to verify that works yet. See issue #7 for tips/ideas.

So presently, the server.py that you run "is" your Selenium hub + node as a single server/instance. And it does not support regular web browsers, just AutoIt. So if you wanted to integrate testing with AutoIt and a web browser (that is not local e.g. not FirefoxDriver but rather another RemoteWebDriver then you need to run 2+ servers: 1 server.py for AutoIt, and a separate Selenium server for web browser (that can be hub + node or just standalone server). There is no "hub + node" for AutoItDriver currently.

If you want to use AutoItDriverServer with Selenium grid, you are own your own for now until I have time, and good luck with that.

from autoitdriverserver.

tanu123 avatar tanu123 commented on June 14, 2024

Hi,
I followed following things to start grid and hib

Step 1
Go to Location where my standalone jar is placed and run below command
java -jar selenium-server-standalone-2.48.2 jar -role hub
It starts my grid.

Step 2:
Launch a node by
java -jar selenium-server-standalone-2.48.2.jar -role webdriver -hub http://localhost:4444/grid/register -port 5566

from autoitdriverserver.

tanu123 avatar tanu123 commented on June 14, 2024

I want to exactly what u have done in calculator.java.

I want to launch an exe and switch over to the the window that gets opened by launching the app.
Since the app is written in node.js, its easrier to locate the elements by driver.find methods.
The only problem I am facing is I am not able to launch that app and switch to the app window using Webdriver.

Your help will be of great use to me.
Request you to respond at the earliest.
Many Thanks

from autoitdriverserver.

daluu avatar daluu commented on June 14, 2024

If you are looking at the specific case of Windows GUI automation with AutoItDriver and not an integrated test (Selenium web browser + AutoIt for something like upload/download files, etc.) then it may be easier to understand taking https://github.com/daluu/AutoItDriverServer/blob/master/sample-code/CalculatorTest.java as an example.

For integration with Selenium web browser, it's a bit more trickier/confusing to a novice user.

To do what you want to do, these are your steps:

  1. Follow the install steps (as needed) here: https://github.com/daluu/AutoItDriverServer#quick-start--serverimplementation-notes
  2. Run the WebDriver code/test, e.g. CalculatorTest.java

There is no hub/node to launch, instead you launch python server.py --port 4444 (default port 4723).

from autoitdriverserver.

tanu123 avatar tanu123 commented on June 14, 2024

Hi,

I followed all the required install steps (as needed) from here: https://github.com/daluu/AutoItDriverServer#quick-start--serverimplementation-notes.

But while running the last command python server.py

I am getting below error.Please help
File "server.py", line 898, in
app.oAutoItX = win32com.client.Dispatch("AutoItX3.Control")
File "C:\Python27\lib\site-packages\win32com\client__init__.py", lin
Dispatch
dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,u
lsctx)
File "C:\Python27\lib\site-packages\win32com\client\dynamic.py", line
_GetGoodDispatchAndUserName
return (_GetGoodDispatch(IDispatch, clsctx), userName)
File "C:\Python27\lib\site-packages\win32com\client\dynamic.py", line
GetGoodDispatch
IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pyt
D_IDispatch)
pywintypes.com_error: (-2147221164, 'Class not registered', None, None)

from autoitdriverserver.

daluu avatar daluu commented on June 14, 2024

Do you have a 64-bit machine? If so, which version of Python do you have installed? 32-bit or 64-bit? If you run python (which gives you a python shell, Ctrl+D, Ctrl+C, or Ctrl+Z to exit shell) or maybe python ---version should report your version.

It sounds like AutoIt (AutoItX/COM) is not registered properly. The install should have taken care of it, but if not, you'd have to manually register it. And/or unregister the inappropriate version of AutoIt first (e.g. 32-bit registered on 64-bit system running 64-bit Python). The following SO post shows how to register a 32-bit and 64-bit COM DLL. If you need to unregister first, add/pass the /u option before specifying the DLL.

You want to register one of these DLLs depending on whether you're using 32 or 64-bit (it will be based on what Python bit version you have installed).

"C:\Program Files (x86)\AutoIt3\AutoItX\AutoItX3.dll"
"C:\Program Files (x86)\AutoIt3\AutoItX\AutoItX3_x64.dll"

from autoitdriverserver.

daluu avatar daluu commented on June 14, 2024

If you want to keep it easy, use 32-bit Python so you work with 32-bit AutoIt, even if you have 64-bit machine. I have installed ActivePython 2.7.2.5 32-bit on my Windows 7 64-bit PC. I forget, but my AutoIt was probably already registered by default with the install, but if not, one can always follow the SO post link to register manually. This setup I've described works for me.

from autoitdriverserver.

tanu123 avatar tanu123 commented on June 14, 2024

Hey
Thanks a ton.It worked.My CalculatorTest.java is running fine now.
But just a quick question(may be last one), when i replace the Calc.exe by my application path(exe).

It opens the app but in background in process but does'nt get shown in monitor

from autoitdriverserver.

daluu avatar daluu commented on June 14, 2024

Glad it finally worked.

On your question, I haven't tested opening a lot of applications. It just opens it using AutoItX.Run() function, however that works. I know it works for calculator and notepad.

If the app exe is a GUI app, it should theoretically show up on the desktop screen, command line executables might behave differently (also depends if it needs command line arguments). Some GUI apps also start up minimized to the desktop, so make sure it's not one of those apps, or you would have to maximize it with driver.manage().window().maximize(), you might have to switch to the window (by name of app window's title in titlebar, etc.) if it isn't already the active window driver.switchTo().window(windowNameOrHandleValue), call driver.getTitle() or driver.getWindowHandle() to see what the current active window is.

It's also possible that apps may open with this server but not become active (covered up by other windows on desktop), so then you would have to specifically switch to the window to bring it into the foreground and make it active for automation. If you see in my sample Calculator demo, I specifically switch to calculator window/app after opening it (in case it isn't the "active" window).

Is your app a custom specific proprietary app to test for your company or one that is publicly shareable/available? If public, I can look into it myself. It's good to have additional data points on what apps have problem running via AutoItDriverServer.

from autoitdriverserver.

tanu123 avatar tanu123 commented on June 14, 2024

Thanks.

Can u pls help..if i want to click an element using xpath..then what would be the syntax
as even giving the correct xpath like;:
driver.findElement(By.xpath("//a[@href='#queue']").click
is throwing below exception
AutoIt failed to click element [REGEXPCLASS://a[@href='#queue']]

is there a different method to write xpath as i read in the below link https://github.com/daluu/AutoItDriverServer/wiki/WebDriver-API-command-support-and-mapping-to-AutoItX-API.
Find Element By XPath = [REGEXPCLASS:value]

Help required

from autoitdriverserver.

daluu avatar daluu commented on June 14, 2024

Do you know how to use AutoIt? AutoItDriverServer is basically a WebDriver interface/API for AutoIt, it isn't a replacement for Selenium WebDriver.

As such, AutoIt doesn't recognize hyperlinks the same way Selenium does, and AutoIt is meant to deal with Windows UI app controls, not browser based web content. If you wanted to figure out what the locator value options are for a hyperlink with AutoIt, you'll want to use a tool like Au3Spy or similar UI spy tools to show you the properties of the UI controls (similar to using Firebug, etc. to figure out the XPath/ID/classname of elements).

If you need to test a Windows UI app and web HTML content, you'll want to take a look at SeleniumIntegrationTest.java, which shows you how you can do that using 2 WebDriver instances - one for web & one for AutoIt. But this of course won't work if you need connect to an existing browser opened by your Windows app, etc. since Selenium can only open its own browsers, not connect to existing ones that are open - for that you'll need to look into WatiN and other tools that offer that option.

FYI, XPath for AutoItDriverServer, as defined in the wiki link you mention maps to REGEXPCLASS in AutoIt. The way you wrote the findElement command is fine. But your XPath value is invalid. You need to read the AutoIt documentation to learn what REGEXPCLASS means & how to use it.

from autoitdriverserver.

tanu123 avatar tanu123 commented on June 14, 2024

Hi David

Thanks a lot for your responses over the time to my queries on AutoItDriver
Server at the below link.

#9

It will be really great and helpful if you can look below my exact problem
statement and let me know whether it is possible to get this automated by
AutoItServer.

I have an application built on *node.js *technology in which the
application launches by clicking the *nw.exe *and then after it opens as
google chrome browser.

I have attached the sample project for your reference(TestApp.zip).Kindly
unzip it , you will see the below folder structure​

TestApp.zip
https://drive.google.com/file/d/0B83WAHvC_4k9eFk1X2RNYnVUaDQ/view?usp=drive_web

Now click on nw.exe. You should see the application like below.

I have followed all the instructions mentioned by you on below link

https://github.com/daluu/AutoItDriverServer

.

My AutoIt Driver is running

Now when I go to automate the basic test case

  1.   Open the app by clicking on nw.exe
    
  2.   Find the element of FirstName text box
    
  3.   And then enter the name as “Tanu” in the text box.
    

I have attached my script for your reference(SampleTest.java).While
running it, I am getting the below exception.

I will really appreciate your help here.

On Tue, Jan 26, 2016 at 12:15 AM, David Luu [email protected]
wrote:

Do you know how to use AutoIt? AutoItDriverServer is basically a WebDriver
interface/API for AutoIt, it isn't a replacement for Selenium WebDriver.

As such, AutoIt doesn't recognize hyperlinks the same way Selenium does,
and AutoIt is meant to deal with Windows UI app controls, not browser based
web content. If you wanted to figure out what the locator value options are
for a hyperlink with AutoIt, you'll want to use a tool like Au3Spy
https://www.autoitscript.com/autoit3/docs/intro/au3spy.htm or similar
UI spy tools to show you the properties of the UI controls (similar to
using Firebug, etc. to figure out the XPath/ID/classname of elements).

If you need to test a Windows UI app and web HTML content, you'll want to
take a look at SeleniumIntegrationTest.java
https://github.com/daluu/AutoItDriverServer/blob/master/sample-code/SeleniumIntegrationTest.java,
which shows you how you can do that using 2 WebDriver instances - one for
web & one for AutoIt. But this of course won't work if you need connect to
an existing browser opened by your Windows app, etc. since Selenium can
only open its own browsers, not connect to existing ones that are open -
for that you'll need to look into WatiN and other tools that offer that
option.

FYI, XPath for AutoItDriverServer, as defined in the wiki link you mention
maps to REGEXPCLASS in AutoIt. The way you wrote the findElement command is
fine. But your XPath value is invalid. You need to read the AutoIt
documentation to learn what REGEXPCLASS means & how to use it.


Reply to this email directly or view it on GitHub
#9 (comment)
.

from autoitdriverserver.

tanu123 avatar tanu123 commented on June 14, 2024

Can u pls see the above comment in an email(same has been sent over email).
As the screenshots attached above are not shown up, thus it will not be properly understood.

from autoitdriverserver.

daluu avatar daluu commented on June 14, 2024

I just took a look, what's the intent of your app? I see it's just a binary executable wrapper (built with node.js) that simply launches a version of Chrome preset to load the index.html file in the local directory.

What you then test is against the UI defined by index.html within the custom Chrome browser. And since the custom Chrome browser is launched by the executable, it can't be controlled by Selenium WebDriver (i.e. ChromeDriver or RemoteWebDriver).

And unfortunately, AutoIt doesn't deal with web/HTML content well. As I mentioned previously, you can use tool like Au3Spy (part of AutoIt installation, called AutoIt Window Info) to see if you can detect any elements and the following screenshot shows there really isn't anything helpful, as you can not specifically locate just the first or last name fields.

nw

For what you want to test, you are better off running a web server (or put the test HTML files on a web server) then using Selenium WebDriver (not this AutoItDriverServer) and connecting to http://webServerHostnameOrIpAddress/index.html and then use Selenium to find and type text into the text fields.

A simple web server you can use locally comes with Python. Simply open a command prompt, and navigate to the folder with your HTML files, then run this command there

for Python 2.x: python -m SimpleHTTPServer 8888 &
for Python 3.x: python -m http.server 8888 &

then just point Selenium (or for manual tests, your browser) to http://localhost:8888/index.html to test.

Even if your actual application requirements call for opening the index.html file via nw.exe through the custom Chrome browser, for automation purposes, you don't need to follow the same steps, because it's just web content that is presented to the user. Opening it directly from a regular browser (FF, Chrome, IE, etc.) is the same thing. Like saying I can use an iPhone, Android, or Windows Phone to make a phone call. They're different models/tools, but in the end I'm still doing the same thing, why does it matter which phone I use to make the phone call? So you can just the nw.exe launch file in custom browser part manually instead and what to test after you can automate the Selenium way.

So your problem really has nothing to do with AutoIt or AutoItDriverServer. For any more help in this issue, I suggest you post to a Selenium user group or forum, like the official one. You will get better and more responses there as it won't be just me. I've already given you all the help I can.

One final note, the index.html file has a "Click here" link to a qatest.html file that was not in the zip file, not that it matters in this discussion.

from autoitdriverserver.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.