Sign in to follow this  
Followers 0
waxriot

Selenium/FF/plugin + AutoIt

6 posts in this topic

Has anyone used AutoIt to control the FF ModifyHeaders plugin in a FF launched by Selenium? An example script would be great. Or even anything for controlling any plugin in RC-launched FF.

Share this post


Link to post
Share on other sites



I don't understand why you would mix the two.

What exactly are you trying to do?


Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Share this post


Link to post
Share on other sites

I don't understand why you would mix the two.

What exactly are you trying to do?

I've been using Selenium to drive web page testing, and need to use a FF plugin called Modify Headers to set test-specific HTTP headers. Since Selenium can only interact with the html in the browser, I need something else to control the plugin.

Your question suggests the possibility that it could all be done in AutoIt, but my test framework is in java and reads Excel files and a database, so not sure I could replicate all that in AutoIt, or if the months of work would be justified to accomplish a few mouse clicks and typing a couple of strings that I hope to get from AutoIt.

Share this post


Link to post
Share on other sites

I see you have two options.

1. You can write an Autoit script to change your plug-in. You will have to execute the script after the session has started.

Example from a class that extends the SeleneseTestCase class.

protected String baseURL = "";
protected String browser = "";

@Override
public void setUp(String baseURL, String browserString) throws Exception {
    if (!browserString.startsWith("*")) {
        this.browser = "*" + browserString;
    } else {
        this.browser = browserString;
    }
    super.setUp(baseURL, this.browser);
    selenium.setSpeed("50");
    
    // Run the autoIt script here
    
    System.out.print("Starting Browser....  ");
    System.out.println("Connecting to: \"" + baseURL + "\"");
    selenium.windowMaximize();

    if (getName() != null) {
        System.out.println("Running Test Case " + getName() + " ...");        
    }
    
}

2. You can look at the options the DefaultSelenium class give you, the selenium is an instance of DefaultSelenium. See DefaultSelenium.

I believe you can reset the headers then set your own using selenium.addCustomRequestHeader()

See here for an example.

Let me know how it goes.


Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Share this post


Link to post
Share on other sites

Thanks, I hadn't noticed selenium.addCustomRequestHeader().

Although it doesn't inspire confidence when the selenium page you point to is an example of someone not being able to get it to work :-)

I'm on another project now, but will come back here when I get back to this one.

I see you have two options.

1. You can write an Autoit script to change your plug-in. You will have to execute the script after the session has started.

Example from a class that extends the SeleneseTestCase class.

protected String baseURL = "";
protected String browser = "";

@Override
public void setUp(String baseURL, String browserString) throws Exception {
    if (!browserString.startsWith("*")) {
        this.browser = "*" + browserString;
    } else {
        this.browser = browserString;
    }
    super.setUp(baseURL, this.browser);
    selenium.setSpeed("50");
    
    // Run the autoIt script here
    
    System.out.print("Starting Browser....  ");
    System.out.println("Connecting to: \"" + baseURL + "\"");
    selenium.windowMaximize();

    if (getName() != null) {
        System.out.println("Running Test Case " + getName() + " ...");        
    }
    
}

2. You can look at the options the DefaultSelenium class give you, the selenium is an instance of DefaultSelenium. See DefaultSelenium.

I believe you can reset the headers then set your own using selenium.addCustomRequestHeader()

See here for an example.

Let me know how it goes.

Share this post


Link to post
Share on other sites

You will have to look but you may find selenium.addCustomRequestHeader() is not in the version you have. The standard version does not seem to contain addCustomRequestHeader().

I think the issue report is due to the person having an existing session then starting a second one so the changes are applied to both.

I would hope selenium is a singleton however I can't remember exactly if one instance is enforced.


Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Share this post


Link to post
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
Sign in to follow this  
Followers 0