rselenium

How to obtain the href element using RSelenium from this code?

我与影子孤独终老i 提交于 2021-01-28 05:44:42
问题 I am using Rselenium to obtain an URL, and I don't understand why is not working. My code: links <- remDr$findElements(using = "xpath", value = "//*[@class = 'item-info']") final_link <- data.frame(link = unlist(sapply(links, function(x) {x$getElementAttribute('href')}))) The code of the page: <div class="item-info"> <p class="title product-field" translate="no" data-track-info=" {"description":"title"}" data-force-track=""> <a href="https://www.kobo.com/us/en/ebook/added-youth" class=""

How to press two keys simultaneously (i.e., control-s) in a webpage using RSelenium?

牧云@^-^@ 提交于 2021-01-27 21:50:00
问题 Let's say I want to select all on a page, copy all or save a page, what is the proper command for RSelenium? The example below seems to press the keys in sequence, what I'm trying to do is tell it to hold the "control" key while it presses "s" library(RSelenium) driver <- rsDriver() remDr <- driver[["client"]] remDr$navigate("https://www.google.com/") remDr$sendKeysToActiveElement(list(key = "control", "s")) 回答1: You need to choose element first: webElem <- remDr$findElement("css", "html")

RSelenium fails to find element on page with dropdowns

守給你的承諾、 提交于 2020-12-15 16:44:25
问题 I'm trying to scrape some data from table that uses dropdowns. The table is, "GIC options". The "Term" is "Mid-Term" and the "Interest Type" is "Compound". Looking at the SO answer here, I tried: library(RSelenium) remDr <- remoteDriver(port = 4445L) remDr$navigate("https://www.nbc.ca/personal/savings-investments/gic/non-redeemable.html") webElem <- remDr$findElement(using = "xpath", '//*[@class="ft2-dropdown-list-element"]/option[@value="Mid-Term"]') and a css version webElem <- remDr

RSelenium fails to find element on page with dropdowns

拜拜、爱过 提交于 2020-12-15 16:34:10
问题 I'm trying to scrape some data from table that uses dropdowns. The table is, "GIC options". The "Term" is "Mid-Term" and the "Interest Type" is "Compound". Looking at the SO answer here, I tried: library(RSelenium) remDr <- remoteDriver(port = 4445L) remDr$navigate("https://www.nbc.ca/personal/savings-investments/gic/non-redeemable.html") webElem <- remDr$findElement(using = "xpath", '//*[@class="ft2-dropdown-list-element"]/option[@value="Mid-Term"]') and a css version webElem <- remDr

How to run javascript using RSelenium?

我的梦境 提交于 2020-07-22 21:35:40
问题 I am trying to click an input object on a webpage using a JS call. First, I'm using RSelenium to pull up the page: library(RSelenium) rD <- rsDriver(port = 4444L, verbose = FALSE) remDr <- rD$client remDr$navigate('https://www.tripadvisor.com/Hotel_Review-g293913-d306432-Reviews-Ambassador_Hotel_Taipei-Taipei.html') From the page I'm trying to click on the button "All languages" from the menu below: I was trying to trigger the click with a call to JS, which works when running the script in

How to run javascript using RSelenium?

假如想象 提交于 2020-07-22 21:35:13
问题 I am trying to click an input object on a webpage using a JS call. First, I'm using RSelenium to pull up the page: library(RSelenium) rD <- rsDriver(port = 4444L, verbose = FALSE) remDr <- rD$client remDr$navigate('https://www.tripadvisor.com/Hotel_Review-g293913-d306432-Reviews-Ambassador_Hotel_Taipei-Taipei.html') From the page I'm trying to click on the button "All languages" from the menu below: I was trying to trigger the click with a call to JS, which works when running the script in

How to send simultaneous keys in RSelenium ALT+S to web driver?

廉价感情. 提交于 2020-06-27 15:23:08
问题 I would like to send two simultaneous keys such as ALT+S to the sendKeysToActiveElement( function of the R Selenium webdriver. I only see implementations in Java and C. Can this be done? 回答1: Use below code :- String selectAll = Keys.chord(Keys.ALT, "s"); driver.findElement(By.xpath("YOURLOCATOR")).sendKeys(selectAll); Hope it will help you :) 回答2: If you want to send a single keystroke then use: cl$sendKeysToActiveElement(sendKeys = list(key = "tab")) If you press more than two keystrokes

How to send simultaneous keys in RSelenium ALT+S to web driver?

折月煮酒 提交于 2020-06-27 15:22:16
问题 I would like to send two simultaneous keys such as ALT+S to the sendKeysToActiveElement( function of the R Selenium webdriver. I only see implementations in Java and C. Can this be done? 回答1: Use below code :- String selectAll = Keys.chord(Keys.ALT, "s"); driver.findElement(By.xpath("YOURLOCATOR")).sendKeys(selectAll); Hope it will help you :) 回答2: If you want to send a single keystroke then use: cl$sendKeysToActiveElement(sendKeys = list(key = "tab")) If you press more than two keystrokes