step e. click "Pack extension"
this will create a .crx file of your extension, which will be placed in the same path as above.
Load the .crx file as part of the preferences for chrome
#Adjust path accordingly. You can rename the file if you like
PathToCRX="C:/Users/MyExtension.crx" #
cprof <- list(chromeOptions =
list(extensions =
list(base64enc::base64encode(PathToCRX))
))
rD <- rsDriver(port = 4444L,extraCapabilities=cprof, browser ="chrome",chromever = "latest")
The remDr variable you create is a "remote driver", an object that handles communication with the browser that’s running in the background. You don’t want to send keys there, you want to send them to some object in the web page that is being displayed.
Depending on the web page, that might be a specific field (e.g. the user name field in a login page), or something bigger. Usually you would use elem <- remDr$findElement(...) to find the element of the web page, then elem$sendKeysToElement(...) to send them.
I’m not sure which element on your web page will handle the keys. I’d guess something like this will work:
2
Answers
This is the solution I found.
Convert the extension to a .crx file.
step a. navigate to chrome://extensions/
step b. click on "developer mode"
step c. click on pack extension. Here I assume you already have the extension up and working.
step d. browse to the folder where the extension was saved. Commonly around this place:
C:/Users/YOURUSERNAME/AppData/Local/Google/Chrome/User Data/Default/Extensions/ekhagklcjbdpajgpjgmbionohlpdbjgc/5.0.114_0
step e. click "Pack extension" this will create a .crx file of your extension, which will be placed in the same path as above.
Load the .crx file as part of the preferences for chrome
The
remDr
variable you create is a "remote driver", an object that handles communication with the browser that’s running in the background. You don’t want to send keys there, you want to send them to some object in the web page that is being displayed.Depending on the web page, that might be a specific field (e.g. the user name field in a login page), or something bigger. Usually you would use
elem <- remDr$findElement(...)
to find the element of the web page, thenelem$sendKeysToElement(...)
to send them.I’m not sure which element on your web page will handle the keys. I’d guess something like this will work:
but you may need to experiment with the first liine.