rselenium

RSelenium cannot access DOM

拟墨画扇 提交于 2019-12-08 08:01:32
问题 I am using Selenium on Stockpair Website s = remoteDriver(remoteServerAddr = "localhost", port = 4444, browserName = "chrome") s$open() url <- "https://www.stockpair.com/sp#trading/page" s$navigate(url) dir <- s$findElement("css selector", "div.stockSelectionButton.left") dir$clickElement() I get the error Error: Summary: StaleElementReference Detail: An element command failed because the referenced element is no longer attached to the DOM. class: org.openqa.selenium

Using Rselenium with firefox and socks5h

倖福魔咒の 提交于 2019-12-08 04:05:41
问题 I'm using the RSelenium package to connect to firefox, but I wish to do it via a socks proxy. In Python, this is achievable using the webdriver package and setting the preferences of the FirefoxProfile, e.g. profile=webdriver.FirefoxProfile() profile.set_preference('network.proxy.socks', x.x.x.x) profile.set_preference('network.proxy.socks_port', ****) browser=webdriver.Firefox(profile) However, I can't find how to try set the proxy to be a socks proxy, or to set the socks port in RSelenium.

RSelenium and Docker on EC2

旧时模样 提交于 2019-12-08 00:23:32
问题 My final goal is to be able to use rselenium through rstudio my EC2 instance (AWS). For that, I read that it is recommeneded to use and install a docker on a virtual machine. So I followed all the steps given by John D Harrison here: https://rpubs.com/johndharrison/RSelenium-Docker And everything went fine except at the end when I enter in RStudio on my EC2 instance. Because when I try to connect to the remote server I get the below error: library(RSelenium) remDr <- remoteDriver

How to clickElement() and open the link in the same tab, not in a new window?

放肆的年华 提交于 2019-12-07 21:07:31
问题 I have the following html element in my webpage: <a target="PARENT" href="/bin-din/WebOb/mom.ko/6/wo/asaksdaksjd /5.1.5.5.33.23.23">View Data Set</a> I use the following command in Rselenium to find that tag: webElem<-remDr$findElement(using = 'xpath',"/html/body/div/table/tbody/tr/td/table[2] /tbody/tr/tbody/tr/td/font/a[1]") Then I use the following command to click on the link: webElem$clickElement() Now the link opens in a new page, probably because the html tag includes target="PARENT".

Run yaml file for parallel selenium test from R or python

泪湿孤枕 提交于 2019-12-07 06:38:29
问题 I have a simple yaml file: seleniumhub: image: selenium/hub ports: - 4444:4444 firefoxnode: image: selenium/node-firefox-debug ports: - 4577 links: - seleniumhub:hub chromenode: image: selenium/node-chrome-debug ports: - 4578 links: - seleniumhub:hub that I have executed in docker: docker-compose up -d I have one hub and two nodes running. Now I would like to run two very simple selenium commands in parallel (written in RSelenium): remDr$open() remDr$navigate("http://www.r-project.org") remDr

RSelenium error: NotConnectedException

你。 提交于 2019-12-07 02:26:52
问题 There are some questions similar to this one already asked in SO (Question 1), (Question 2), but none of those has received an answer (the last one has a relevant comment by @jdharrison directing the OP to file an issue). This is my problem: I used to have a very simple script to get some information from a website into R: startServer() rd<-remoteDriver(remoteServerAddr="localhost",port=4444,browserName="firefox") rd$open() rd$navigate(url) #with a defined url When I now try and run the

How to clickElement() and open the link in the same tab, not in a new window?

浪子不回头ぞ 提交于 2019-12-06 15:55:04
I have the following html element in my webpage: <a target="PARENT" href="/bin-din/WebOb/mom.ko/6/wo/asaksdaksjd /5.1.5.5.33.23.23">View Data Set</a> I use the following command in Rselenium to find that tag: webElem<-remDr$findElement(using = 'xpath',"/html/body/div/table/tbody/tr/td/table[2] /tbody/tr/tbody/tr/td/font/a[1]") Then I use the following command to click on the link: webElem$clickElement() Now the link opens in a new page, probably because the html tag includes target="PARENT". How can I open that link in the same tab which I am in remDr? Any suggestions? Thanks Bhupesh First you

rvest vs RSelenium results for text extracting

梦想与她 提交于 2019-12-06 15:04:28
问题 So far i am using RSelenium to extract the text of a Homepage, but i would like to Switch to a fast solution like rvest . library(rvest) url = 'https://www.r-bloggers.com' rvestResults <- read_html(url) %>% html_node('body') %>% html_text() library(RSelenium) remDr$navigate(url) rSelResults <- remDr$findElement( using = "xpath", value = "//body" )$getElementText() Comparing the results below Shows that rvest includes some JavaScript Code, while the RSelenium is much "cleaner". I am aware of

Parse HTML and Read HTML Table with Selenium Python

烂漫一生 提交于 2019-12-06 14:40:58
问题 I am converting some of my web-scraping code from R to Python (I can't get geckodriver to work with R, but it's working with Python). Anyways, I am trying to understand how to parse and read HTML tables with Python. Quick background, here is my code for R: doc <- htmlParse(remDr$getPageSource()[[1]],ignoreBlanks=TRUE, replaceEntities = FALSE, trim=TRUE, encoding="UTF-8") WebElem <- readHTMLTable(doc, stringsAsFactors = FALSE)[[7]] I would parse the HTML page to the doc object. Then I would

R - Rselenium - navigate drop down menu / list / box using = 'id'

眉间皱痕 提交于 2019-12-06 14:14:16
How can I navigate a dynamic drop down list via " using = 'id' " (e.g., remDr$findElement(using='id', value="main_ddYear") ? I can find and click using findElement . After clicking I could send "down arrow" keys (keystrokes) and an "enter" if I know how many arrows down my targeted selection is. Sample of the page source <select name="main$ddYear" onchange="javascript:setTimeout('__doPostBack(\'main$ddYear\',\'\')', 0)" id="main_ddYear" class="groupTextBox"> <option selected="selected" value="2017">2017</option> <option value="2016">2016</option> <option value="2015">2015</option> <option