如何使用 Rselenium 修改颜色?
How to modify colors using Rselenium?
我想更改本网站的前景色和背景色(https://www.qrcode-monkey.com/#url)
使用 Rselenium
我们必须先清除该字段以设置新值,
#launch browser
driver = rsDriver(browser = c("firefox"))
remDr <- driver[["client"]]
remDr$navigate('https://www.qrcode-monkey.com/#url')
remDr$findElement('xpath', '/html/body/div[2]/div[2]/div[2]/div/div/div[1]/div/div[2]/div[1]/h3')$clickElement()
remDr$findElement(using = "xpath", '/html/body/div[2]/div[2]/div[2]/div/div/div[1]/div/div[2]/div[2]/div[1]/div[4]/div/color-picker/div/div[1]/input')$clickElement()
webElem = remDr$findElement(using = "xpath", '/html/body/div[2]/div[2]/div[2]/div/div/div[1]/div/div[2]/div[2]/div[1]/div[4]/div/color-picker/div/div[1]/input')
webElem$sendKeysToElement(list(key = 'backspace')) #repeat the step six times to clear the field
#set color to red
webElem$sendKeysToElement(list("#FF0000"))
我想更改本网站的前景色和背景色(https://www.qrcode-monkey.com/#url)
使用 Rselenium
我们必须先清除该字段以设置新值,
#launch browser
driver = rsDriver(browser = c("firefox"))
remDr <- driver[["client"]]
remDr$navigate('https://www.qrcode-monkey.com/#url')
remDr$findElement('xpath', '/html/body/div[2]/div[2]/div[2]/div/div/div[1]/div/div[2]/div[1]/h3')$clickElement()
remDr$findElement(using = "xpath", '/html/body/div[2]/div[2]/div[2]/div/div/div[1]/div/div[2]/div[2]/div[1]/div[4]/div/color-picker/div/div[1]/input')$clickElement()
webElem = remDr$findElement(using = "xpath", '/html/body/div[2]/div[2]/div[2]/div/div/div[1]/div/div[2]/div[2]/div[1]/div[4]/div/color-picker/div/div[1]/input')
webElem$sendKeysToElement(list(key = 'backspace')) #repeat the step six times to clear the field
#set color to red
webElem$sendKeysToElement(list("#FF0000"))