Problem sending multiple keys to Selenium with Edge

robw

Board Regular
Joined
Dec 18, 2002
Messages
161
Hi
I've been exploring the use of Selenium to control/access a webpage in Edge.
I'm having real difficulty correctly sending the character sequence Ctrl + Alt + a to an input field on webpage.
It works fine if I just send a simple string such as "a" , so I guess it's something I'm doing wrong with the multiple key construction.
Any ideas?

Many Thanks
Rob


My code is as follows:-

Sub gogo()
Dim driver As New Selenium.WebDriver
Dim mykey As New Selenium.Keys


driver.Start "Edge"
driver.Get "WEALTH at work Trading Platform - Sign In Page"
driver.FindElementById("username").Click
snooze 5000 'sleep 5 secs

With driver.Actions
.KeyDown (mykey.Control)
.KeyDown (mykey.Alt)
.SendKeys ("a")
.KeyUp (mykey.Control)
.KeyUp (mykey.Alt)
.Perform
End With


End Sub
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
This depends a lot on if the VBA wrapper you are using can handle it or not (wherever these bindings came from ... unknown to me). What kind of UserName requires Control-Alt-A?
 
Upvote 0
Thanks xenou
I found that I could simply use Application.Sendkeys "^%a" instead. This sends the required string and it has the desired result....Not a Selenium Method, which makes me feel a bit "unclean", but I guess I should be happy that it works

The string is a hotkey combo that instructs my password manager to enter the relevant uid/pw

Thanks for your help
Rob
 
Upvote 0

Forum statistics

Threads
1,214,812
Messages
6,121,696
Members
449,048
Latest member
81jamesacct

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top