mercredi 28 juin 2017

input rows of a column in to a for loop

I've have a data frame (df) in which there is a column g which has the below data

g
 1         check
 2    2267631926
 3          <NA>
 4         check
 5         check
 6         check
 7         check
 8         check
 9         check
10         check
11         check
12         check
13         check
14         check
15         check
16         check
17         check
18         check
19    2090125960
20          <NA>
21         check
22         check

I'm trying to input only the numeric values (2090125960) in into a web link and jump the others (check, NA) using the css selectors one by one and follow next commands but, it is pasting the complete list.

` for(i in g)
  {

 mybrowser$navigate("https://www.google.com")

fg<- mybrowser$findElement(using = 'css selector',"#lst-ib")
fg$clickElement()
Sys.sleep(1)
fg$sendKeysToElement(i)

Go<- mybrowser$findElement(using = 'css selector',"#tsf > div.tsf-p > div.jsb > center > input[type="submit"]:nth-child(1)")
Go$clickElement()

}`

Now I'm trying to enter the numeric value (one at a time) in the google search bar and hit on search then take the second value and click on search. I think this should clear my doubt.

I tried to convert the columns into factor or numeric. Any ideas would help. Thank you.

Aucun commentaire:

Enregistrer un commentaire