SendKeys() in Selenium is too slow while typing wo

2019-10-03 07:13发布

问题:

I am reading an excel row which has 4 or 5 cells and I am sending the data one by one to text boxes on a webpage using sendKeys() in selenium. But its too slow. Suppose I got a word 78845 from the first cell in the excel, then while inserting into the text box it takes 5 seconds like 7 then 5 seconds then 8 again wait for 5 seconds and so on. Its too slow.

What can be done here?

回答1:

Add "iexplore.exe" in Registry.

1.Press "Start button + R".
2.Type "regedit".
3.In opened Registry Editor window, navigate to below path:

HKEY LOCAL MACHINE > Software > wow6432Node > Microsoft > Internet Explorer > Main > Feature Control > FEATURE_BFCACHE

4.Right click on "FEATURE_BFCACHE" > click "New" > Click "DWORD (32bit) Value".
5.Enter "iexplore.exe" and save.

Now, run your Test Cases. It will be faster than previous.



回答2:

  • Try the 32-bit version of IEDriverServer.

  • If it doesn't help, you can set Capabilities like,

DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer(); capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true); capabilities.setCapability("requireWindowFocus", true); WebDriver driver = new InternetExplorerDriver(capabilities);