Jump to content

AutoIt error (Selenium Test automation) - (Moved)


Recommended Posts

Hi,

This is my Selenium Test script:

package com.cstudymaven.testscript;

import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.Test;

import com.cstudymaven.utilities.ReadExcel;
import com.cstudymaven.pompages.EditProfile;
import com.cstudymaven.pompages.SignInPage;
import com.cstudymaven.utilities.BaseTest;

public class TestScript extends BaseTest
{
    SignInPage signin = null;
    EditProfile edprf=null;
    
    @Test
    public void signUp() 
    {
    
        String[][] credentials = ReadExcel.getData(filePath, "User_Login");
        try {

            for (int i = 1; i < credentials.length; i++) {
                String email = credentials[0];
                String password = credentials[1];
                signin = new SignInPage(driver);
                signin.clickonLogin();
                Thread.sleep(1500);
                signin.enterEmail(email);
                Thread.sleep(1500);
                signin.enterPassword(password);
                signin.clicktoStart();
                edprf=new EditProfile(driver);
                wait = new WebDriverWait(driver, 10);
                Thread.sleep(1500);
                edprf.editprofile();
                Thread.sleep(1500);
                edprf.gotoprofile();
                Thread.sleep(1500);
                edprf.editlogo();
                wait = new WebDriverWait(driver, 10);
                Thread.sleep(2700);
                edprf.camera();
                Thread.sleep(2500);
                edprf.cfile();
                Thread.sleep(1500);
                runAutoIT();       //AutoIT function
                
            }
        }
        
        catch (Exception e) 
        {
            e.printStackTrace();
            try 
            {

            } 
            catch (Exception e1) 
            {

            }

        }
    
}                 //C:\\Users\\LOBO\\Desktop\\Manfred\\Resume\\1Amanfred.jpg

//AutoIT method to handle windows dialog box

public void runAutoIT() throws Exception
{
    String strFilePath="C:\\Users\\LOBO\\1Amanfred.jpg";    
    String strPath="C:\\Users\\LOBO\\eclipse-workspace\\CaseStudyMaven\\InputData\\cstudymaven.exe";
    String strParameter=strPath+" "+strFilePath;
    Runtime.getRuntime().exec(strParameter);
}

}

Facing the following Error:" Unknown Function Name" . Details in screenshot below

Fig 1: AutoIt Script

Fig 2: Error Window

 

 

5c207c0cc3918_WhatsAppImage2018-12-24at11_43_31AM.jpeg.e05759f25ca7354812ce43fe71d08414.jpeg   Fig 1

5c207c0bf3a66_WhatsAppImage2018-12-24at11_49.07AM(1).jpeg.e71f6f0cfda56449f3ba461100a4d134.jpegFig2

Link to comment
Share on other sites

Hi,

Made the above changes, but the selenium execution is not placing the file specified in the filename box and the test execution ends

When i open the below autoit script file, i get this error - " Array variable has incorrect number of subscripts or subscript dimension range exceeded." Require your help here urgently. Thank you

 

image.png.c82b67f7eae8d91caf3dde8aa4e55a5b.png

image.png.4272ea8038b4b3555f24ea50ce481cc5.png

 

 

Capturea.JPG

Link to comment
Share on other sites

  • Developers

Please stop posting all these screen captures and simple post the error message and code in CodeBoxes by clicking on <> and doing a Cut&Paste.:)
That error means that no parameter is provide when the script is ran, which sounds correct when you just run the script. 

So where is the fire? :) 

2 hours ago, ManfredLobo said:

Require your help here urgently

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

runAutoIT();  // this function runs successfully

//selenium does not continue with executing the below line of code

js.executeScript("window.scrollBy(0,150)");  //scroll down the browser
WebElement upld = driver.findElement(By.xpath("//button[@type='submit']"));
upld.click();

 

Edited by ManfredLobo
Link to comment
Share on other sites

  • Moderators

Moved to the appropriate forum, as the Developer General Discussion forum very clearly states:

Quote

General development and scripting discussions. If it's super geeky and you don't know where to put it - it's probably here.


Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums.

Moderation Team

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

16 hours ago, Danp2 said:

You haven't provided enough information for us to give you a definitive answer, but it would seem logical to investigate the call to runAutoIT() and confirm that it has actually finished executing and has returned operation to the calling routine.

I am writing a selenium automation test script that involves uploading my picture as the profile picture in a portal. The process executes successfully until I call the runAutoit() function that loads the picture in the windows explorer box and clicks on open but does not consider the 3 lines of code after this point. To summarize my concern - "The control does not continue with the selenium execution after the runAutoIt() method.

This is my selenium code in which i have called the runAutoIT() function

*******

package com.cstudymaven.testscript;

import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.Test;

import com.cstudymaven.utilities.ReadExcel;
import com.cstudymaven.pompages.EditProfile;
import com.cstudymaven.pompages.SignInPage;
import com.cstudymaven.utilities.BaseTest;

public class TestScript extends BaseTest
{
    SignInPage signin = null;
    EditProfile edprf=null;
    
    @Test
    public void signUp() 
    {
        
        JavascriptExecutor js = (JavascriptExecutor) driver;
            String[][] credentials = ReadExcel.getData(filePath, "User_Login");
        try {

            for (int i = 1; i < credentials.length; i++) {
                String email = credentials[0];
                String password = credentials[1];
                signin = new SignInPage(driver);
                signin.clickonLogin();
                Thread.sleep(1500);
                signin.enterEmail(email);
                Thread.sleep(1500);
                signin.enterPassword(password);
                signin.clicktoStart();
                edprf=new EditProfile(driver);
                wait = new WebDriverWait(driver, 10);
                Thread.sleep(1500);
                edprf.editprofile();
                Thread.sleep(1500);
                edprf.gotoprofile();
                Thread.sleep(1500);
                edprf.editlogo();
                wait = new WebDriverWait(driver, 10);
                Thread.sleep(2700);
                edprf.camera();
                Thread.sleep(2500);
                edprf.cfile();
                Thread.sleep(1500);
                runAutoIT();           ................................................................................................     //code executes successfully until this point and states that execution is completed
 ...............................................................................................................................................     //below line of code does not execute             
                ((JavascriptExecutor) driver).executeScript("window.focus();");
                 js.executeScript("window.scrollBy(0,150)");  //scroll down the browser
                WebElement upld = driver.findElement(By.xpath("//button[@type='submit']"));
                upld.click();
                
            }
        }
        
        catch (Exception e) 
        {
            e.printStackTrace();
            try 
            {

            } 
            catch (Exception e1) 
            {

            }

        }
    
}               

//AutoIT method to handle windows dialog box

public void runAutoIT() throws Exception
{
    String strFilePath="C:\\Users\\LOBO\\1Amanfred.jpg";    
    String strPath="C:\\Users\\LOBO\\eclipse-workspace\\CaseStudyMaven\\InputData\\cstudymaven.exe";
    String strParameter=strPath+" "+strFilePath;
    Runtime.getRuntime().exec(strParameter);
}

}

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...