From reading your question, I believe that you are tackling your problem incorrectly. Since I cannot tell what sort of authentication you are dealing with in your browser, I suppose I can show you a form and HTTP 401, which will most likely cover the general scenarios. If you need some other example, for a different way to authenticate, do let us know.
If I have misread your request, and you actually want to hook onto a manually started instance of a browser, which is not provided by default, you have to get really creative. Regardless, that question is answered here.
However, as far as my recommendation goes, I would highly recommend that you get rid of that vb script / manual browser starting if possible. If you can authenticate through your browser, than you can do it through selenium. Here are some examples:
Note, this is a good guide on how to use the InternetExplorerDriver
Scenario 1: Using an HTML Form
Sample HTML Code:
<form>
<table id="credentials_table">
<tbody>
<tr>
<td class="credentials_table_label_cell"><label for="username" id="label_input_1">Username</label></td>
<td class="credentials_table_field_cell"><input class="credentials_input_text" value="" id="username" autocomplete="off" autocapitalize="off" type="text"></td>
</tr>
<tr>
<td class="credentials_table_label_cell"><label for="password" id="label_input_2">Password</label></td>
<td class="credentials_table_field_cell"><input class="credentials_input_password" value="" id="password" autocomplete="off" autocapitalize="off" type="password"></td>
</tr>
<tr id="submit_row">
<td class="credentials_table_field_cell"><input class="credentials_input_submit" value="Logon" type="submit"></td>
</tr>
</tbody></table>
</form>
Sample Selenim Code to Login:
private WebDriver driverForA = new InternetExplorerDriver();
private WebDriver driverForB = new InternetExplorerDriver();
@After
public void after() {
driverForA.close();
driverForB.close();
}
@Test
public void testADoesThisAndBDoesThat() {
driverForA.get("http://my.login.url");
final WebElement usernameInput = driverForA.findElement(By.id("username"));
final WebElement passwordInput = driverForA.findElement(By.id("password"));
final WebElement submitButton = driverForA.findElement(By.xpath("//input[@type='submit' and @value='Logon']"));
// perform the login stuff
clearKeysAndSetValue(usernameInput, "Joe");
clearKeysAndSetValue(passwordInput, "superSecret");
submitButton.click();
// navigate to other pages and do things
driverForB.get("http://my.approval.page");
final WebElement approveButton = driverForB.findElement(By.id("approval_Button"));
approveButton.click();
}
private void clearKeysAndSetValue(final WebElement element, final String valueToSet) {
element.clear();
element.sendKeys(valueToSet);
}
Scenario 2: Using HTTP 401
private final WebDriver driverForA = new InternetExplorerDriver();
private final WebDriver driverForB = new InternetExplorerDriver();
@After
public void after() {
driverForA.close();
driverForB.close();
}
@Test
public void testADoesThisAndBDoesThatHttpBasic() {
// authenticate as a
WebDriverWait wait = new WebDriverWait(driverForA, 5);
Alert alert = wait.until(ExpectedConditions.alertIsPresent());
alert.authenticateUsing(new UserAndPassword("Joe", "superSecret"));
// navigate to other pages and do things
driverForB.get("http://my.approval.page");
final WebElement approveButton = driverForB.findElement(By.id("approval_Button"));
approveButton.click();
}