selenium-webdriver

R - Waiting for page to load in RSelenium with PhantomJS

无人久伴 提交于 2020-01-31 12:41:49
问题 I put together a crude scraper that scrapes prices/airlines from Expedia: # Start the Server rD <- rsDriver(browser = "phantomjs", verbose = FALSE) # Assign the client remDr <- rD$client # Establish a wait for an element remDr$setImplicitWaitTimeout(1000) # Navigate to Expedia.com appurl <- "https://www.expedia.com/Flights-Search?flight-type=on&starDate=04/30/2017&mode=search&trip=oneway&leg1=from:Denver,+Colorado,to:Oslo,+Norway,departure:04/30/2017TANYT&passengers=children:0,adults:1" remDr

selenium.common.exceptions.SessionNotCreatedException: Message: session not created: Chrome version must be between 70 and 73 with ChromeDriver

时光毁灭记忆、已成空白 提交于 2020-01-31 03:14:37
问题 I am trying to create a webcrawler using Selenium, but I get this error when I try to create the webdriver object. selenium.common.exceptions.SessionNotCreatedException: Message: session not created: Chrome version must be between 70 and 73 (Driver info: chromedriver=2.45.615291 (ec3682e3c9061c10f26ea9e5cdcf3c53f3f74387),platform=Windows NT 6.1.7601 SP1 x86_64) I downloaded the latest version of chromedriver (2.45) which requires Chrome 70-73. My current Chrome version is 68.0.3440.106

selenium.common.exceptions.SessionNotCreatedException: Message: session not created: Chrome version must be between 70 and 73 with ChromeDriver

牧云@^-^@ 提交于 2020-01-31 03:13:06
问题 I am trying to create a webcrawler using Selenium, but I get this error when I try to create the webdriver object. selenium.common.exceptions.SessionNotCreatedException: Message: session not created: Chrome version must be between 70 and 73 (Driver info: chromedriver=2.45.615291 (ec3682e3c9061c10f26ea9e5cdcf3c53f3f74387),platform=Windows NT 6.1.7601 SP1 x86_64) I downloaded the latest version of chromedriver (2.45) which requires Chrome 70-73. My current Chrome version is 68.0.3440.106

Python Selenium - How to loop to the last <li> element in a site

左心房为你撑大大i 提交于 2020-01-30 13:04:34
问题 I have created a python selenium script that should navigate through a website and collect people profiles (https://www.shearman.com/people). The program won't loop through the pages to collect the links. I have used this which doesn't work; try: # this is navigate to next page driver.find_element_by_xpath('//div[@id="searchResultsSection"]/ul/li[12]').click() time.sleep(1) except NoSuchElementException: break The syntax behind the next button can be seen below; <a href="" onclick=

Python Selenium - How to loop to the last <li> element in a site

◇◆丶佛笑我妖孽 提交于 2020-01-30 13:03:06
问题 I have created a python selenium script that should navigate through a website and collect people profiles (https://www.shearman.com/people). The program won't loop through the pages to collect the links. I have used this which doesn't work; try: # this is navigate to next page driver.find_element_by_xpath('//div[@id="searchResultsSection"]/ul/li[12]').click() time.sleep(1) except NoSuchElementException: break The syntax behind the next button can be seen below; <a href="" onclick=

Decoding Class names on facebook through Selenium

百般思念 提交于 2020-01-30 12:30:32
问题 I noticed that facebook has some weird class names that look computer generated. What I don't know is if these classes are at least constant over time or they change in some time interval? Maybe someone who has experience with that can answer. Only thing I can see is that when I exit Chrome and open it again it is still the same, so at least they don't change every browser session. So I'd guess the best way to go about scraping facebook would be to use some elements in user interface and

Selenium invisibilityOf(element) method throwing NoSuchElementException + WebDriverWait.ignoring(NoSuchElementException.class) is not working

◇◆丶佛笑我妖孽 提交于 2020-01-30 11:42:44
问题 This query consists of 2 related questions. I need to wait for an element to be invisible before I go to next step, hence I tried to define a custom method as below: public void waitToDisappear(long timeOutInSeconds, WebElement element) { WebDriverWait wait = new WebDriverWait(driver, timeOutInSeconds); wait.ignoring(org.openqa.selenium.NoSuchElementException.class); wait.until(ExpectedConditions.invisibilityOf(element)); } When I call this method as common.waitToDisappear(5, <WebElement>); ,

Selenium invisibilityOf(element) method throwing NoSuchElementException + WebDriverWait.ignoring(NoSuchElementException.class) is not working

北城以北 提交于 2020-01-30 11:41:10
问题 This query consists of 2 related questions. I need to wait for an element to be invisible before I go to next step, hence I tried to define a custom method as below: public void waitToDisappear(long timeOutInSeconds, WebElement element) { WebDriverWait wait = new WebDriverWait(driver, timeOutInSeconds); wait.ignoring(org.openqa.selenium.NoSuchElementException.class); wait.until(ExpectedConditions.invisibilityOf(element)); } When I call this method as common.waitToDisappear(5, <WebElement>); ,

java.lang.NullPointerException using static WebDriver instance

巧了我就是萌 提交于 2020-01-30 11:40:47
问题 I want to separate my code in to smaller functions. But had an issue as driver was not available to all functions. So i declared it as a constant (or is there a better way of doing this ?) but in 3rd function it is failing on line : Select dropdown_finance_product = new Select(driver.findElement(By.xpath("//select[@id='ResultsNumber']"))); Here is the console message : Exception in thread "main" java.lang.NullPointerException at Scraping.scrapeit.fetch_urls(scrapeit.java:49) at Scraping

Fail to download file with opened new tab in headless mode on Linux

大兔子大兔子 提交于 2020-01-30 11:21:22
问题 As this answer by myself: How to download files headless in Selenium (Java) when download happens in new tab? If download button trigger download action in opened new tab, I will switch to new tab and send command(as below code) to download file. def enable_download_in_headless_chrome(self, driver, download_path): driver.command_executor._commands["send_command"] = ("POST", '/session/$sessionId/chromium/send_command') params = { 'cmd': 'Page.setDownloadBehavior', 'params': {'behavior': 'allow