Skip to main content
Transform your testing process with: Real Device Features, Company-wide Licences, & Test Observability

Using sendKeys on remote IE-11 browser

You can correctly input text on remote IE-11 browsers in Automate through a custom BrowserStack capability.

Introduction

sendkeys() is a method in Selenium that allows you to type content automatically into an editable field while executing any tests.

Now, while running a Selenium test on IE11 locally or through a grid, you will sometimes face one or more of the following issues with the sendKeys Selenium command:

  1. IE Driver mistypes certain special characters
  2. Some characters are dropped from the input string
  3. The command execution is slow

(Refer to the GitHub Issue for more information.)

To solve all the above issues, BrowserStack has a custom capability as explained in the next section.

BrowserStack capability to solve sendKeys() issue in IE-11

BrowserStack provides a custom capability that fixes the issue with sendKeys on the IE-11 browser. If you use the below capability in your test script and then use the sendKeys command, then you will not experience the bug (as stated above) while running your tests on BrowserStack.

Sample code to include the custom capability

If you are using BrowserStack SDK, you can set the following capabilities in the browserstack.yml file:

Copy icon Copy snippet

BrowserStack SDK is a plug-n-play solution that takes care of all the integration steps for you. Using the BrowserStack SDK is the recommended integration method for your project. To know more, visit the SDK core concepts page.

The capability as shown below, needs to be declared along with all other capabilities like browser, os etc. at the start of the test script and you will still need to use the sendKeys command as you have been using, for entering keyboard inputs into an editable field. The code snippet below shows how to declare the sendKeys capability at the start of your test script:

Capability Accepted Values Default
sendKeys true, false false
MutableCapabilities capabilities = new MutableCapabilities();
HashMap<String, Object> browserstackOptions = new HashMap<String, Object>();
browserstackOptions.put("sendKeys", "true");
capabilities.setCapability("bstack:options", browserstackOptions);
var capabilities = {
	'bstack:options' : {
		"sendKeys" : "true"
	},
	"browserName" : "IE",
}
// for internet explorer
InternetExplorerOptions capabilities = new InternetExplorerOptions();
Dictionary<string, object> browserstackOptions = new Dictionary<string, object>();
browserstackOptions.Add("sendKeys", "true");
browserstackOptions.Add("browserName", "IE");
capabilities.AddAdditionalOption("bstack:options", browserstackOptions);
$caps = array(
	'bstack:options' => array(
		"sendKeys" => "true"
	),
	"browserName" => "IE",
)
desired_cap = {
	'bstack:options' : {
		"sendKeys" : "true",
	},
	"browserName" : "IE",
}
capabilities = {
	'bstack:options' => {
		"sendKeys" => "true"
	},
	"browserName" => "IE",
}

The capability as shown below, needs to be declared along with all other capabilities like browser, os etc. at the start of the test script and you will still need to use the sendKeys command as you have been using, for entering keyboard inputs into an editable field. The code snippet below shows how to declare the browserstack.sendKeys capability at the start of your test script:

Capability Accepted Values Default
browserstack.sendKeys true, false false
caps.setCapability("browserstack.sendKeys", "true");

capabilities['browserstack.sendKeys'] = 'true';
// for internet explorer
InternetExplorerOptions capability = new InternetExplorerOptions();
capability.AddAdditionalCapability("browserstack.sendKeys", "true", true);
$caps['browserstack.sendKeys'] = "true";
caps["browserstack.sendKeys"] = "true"
caps["browserstack.sendKeys"] = "true"
my $capabilities = {
  "browserstack.sendKeys" => "true"
}

You can contact support if the capability does not resolve the issue with the sendKeys command in IE-11.

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked






Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked






Thank you for your valuable feedback!

Talk to an Expert
Download Copy