I'm looking to use RSelenium to input some gene names into an online repository that creates a functional annotation heatmap for said genes.
However, I'm struggling to work out how to input the gene list into the text box to generate the heatmap.
Here is an image of the text box and the html associated with it.
The code I have so far (see below) can navigate successfully to the appropriate page, and select the appropriate text box but I can't work out how to input the text such that the list of genes at the bottom of the html code is added to as if I was typing the genes in manually. Note, the genes you can see in text box in the image were input manually.
##### Load driver and navigate to site #####
driver <- rsDriver(browser=c("chrome"), chromever="80.0.3987.106")
remDr <- driver[["client"]]
remDr$navigate("http://solo.bmap.ucla.edu/shiny/webapp/")
## Select heatmap option
gene_toggle <- remDr$findElement(using = 'css', '[class="dropdown-toggle"]')
gene_toggle$clickElement()
input <- remDr$findElement(using = 'css', '[data-value="panel-Heatmap"]')
input$clickElement()
## Input gene list to text box - not working yet - can't get text to enter properly
gene_select <- remDr$findElement(using = 'css', '[class="selectize-input items not-full has-options has-items"]')
gene_select$clickElement()
##### NOTE I HAVE TRIED THESE OPTION BELOW ....
gene_select$sendKeysToElement("NEUROD1")
gene_select$sendKeysToElement(list("NEUROD1"))
gene_select$sendKeysToElement(list("NEUROD1", key = "enter"))
gene_select$sendKeysToElement(list("NEUROD6, NEUROD2"))
I feel like I'm almost there, but unsure if I'm selecting the wrong element or formatting the sendKeysToElement
command wrongly. I'm fairly new to RSelenium.
Any advice would be greatly appreciated.
You're almost there indeed, just need to select the <input>
element inside your gene_select
:
input <- gene_select$findChildElement(using = 'xpath', value = 'input')
input$sendKeysToElement(list("NEUROD2", key = "enter"))