5

Autoit has an order value, which I want to pass it to the database as an argument to get table contents of that order id.

I tried passing from command-line, but I don't want the arguments to get passed from the command line. I am using Selenium web driver with Java.

JAINAM
1,8453 gold badges19 silver badges39 bronze badges
asked Sep 26, 2015 at 6:21

2 Answers 2

1

You could store them in an .INI file and read this during your tests in your @BeforeClass using:

Preferences args = new IniFile(new File(fname));

Since my tests are coming from HP ALM and the testng-suite.xml is generated automatically, I simply added my arguments as parameters into the XML. You could also use AutoIt to add the lines into your testng-suite.xml

<suite verbose="-1" name="TestAutomationTest.MBC-POS-Suite" configfailurepolicy="skip" preserve-order="true">
 <parameter name="selenium.url" value="https://dfs.com" />

You can access them then in your test method, each parameter is one argument in your test method:

@Test
@Parameters({"selenium.url", "timeOut.msec"})
public void testMethod(String url, int timeout)
answered Oct 9, 2015 at 8:42
1

Below is the code snippet to pass arguments to autoit script, which then can be used in Selenium for uploading a file where we can pass the file path dynamically.

ControlFocus("File Upload", "", "Edit1")
ControlSetText("File Upload", "", "Edit1", $CmdLine[1])
ControlClick("File Upload", "" , "Button1")

Here, CmdLine[1] is the argument that we are passing dynamically.

answered Jul 24, 2019 at 12:59

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.