splinter

Failing to open HTTPS pages in PhantomJS using Splinter

别说谁变了你拦得住时间么 提交于 2019-12-13 06:38:08
问题 I'm trying to use PhantomJS to write a scraper but even the example in the documentation of morph.io is not working. I guess the problem is "https", I tested it with http and it is working. Can you please give me a solution? I tested it using firefox and it works. from splinter import Browser with Browser("phantomjs") as browser: # Optional, but make sure large enough that responsive pages don't # hide elements on you... browser.driver.set_window_size(1280, 1024) # Open the page you want...

Work with hidden select elemens in splinter (and selenium)

試著忘記壹切 提交于 2019-12-11 18:50:54
问题 I have a problem with splinter. I try to execute this code: # -*- coding: utf-8 -*- from splinter import Browser browser = Browser() browser.visit('https://passport.yandex.com/registration/mail') browser.find_by_name("hint_question_id").click() browser.select("hint_question_id","12") But get this error: selenium.common.exceptions.ElementNotVisibleException: Message: u'Element is not currently visible and so may not be interacted with' ; Stacktrace: at fxdriver.preconditions.visible (file:///c

Saving image element using splinter python

会有一股神秘感。 提交于 2019-12-11 10:10:03
问题 How can I save image picture to a file? i tried this way but i have an error. the code is : from splinter import Browser import time with Browser() as browser: url = "https://password.gmx.com/" browser.visit(url) captcha=browser.find_by_id('recaptcha_challenge_container') output = open ("image.jpg","wb") output.write(captcha) output.close() 回答1: Additional note to @alecxe's answer: splinter doesn't have an interface for getting attribute of web element (i.e. get_attribute method). Use the

Splinter or Selenium: Can we get current html page after clicking a button?

萝らか妹 提交于 2019-12-09 17:34:51
问题 I'm trying to crawl the website "http://everydayhealth.com". However, I found that the page will dynamically rendered. So, when I click the button "More", some new news will be shown. However, using splinter to click the button doesn't let "browser.html" automatically changes to the current html content. Is there a way to let it get newest html source, using either splinter or selenium? My code in splinter is as follows: import requests from bs4 import BeautifulSoup from splinter import

ElementNotVisibleException only in virtual display

孤街醉人 提交于 2019-12-08 12:50:27
问题 I have a script that needs to interact with a webpage via selenium. I need to use some kind of virtual display to keep the browser from showing up. The script as a whole works great until I introduce Xvfb into the mix. When I do that I get an ElementNotVisibleException the first time I actually try to interact with the page. I've tried using xvfbwrapper and pyvirtualdisplay with the same effect. And here is code that doesn't work: from xvfbwrapper import Xvfb vdisplay = Xvfb() vdisplay.start(

Python Splinter Get Value From Table (Following-Sibling)

断了今生、忘了曾经 提交于 2019-12-08 09:12:22
问题 Given this code ("sleep" instances used to help display what's going on): from splinter import Browser import time with Browser() as browser: # Visit URL url = "https://mdoe.state.mi.us/moecs/PublicCredentialSearch.aspx" browser.visit(url) browser.fill('ctl00$ContentPlaceHolder1$txtCredentialNumber', 'IF0000000262422') # Find and click the 'search' button button = browser.find_by_name('ctl00$ContentPlaceHolder1$btnSearch') # Interact with elements button.first.click() time.sleep(5) #Only

How select class , div , tag in splinter?

浪尽此生 提交于 2019-12-08 05:28:37
问题 I am trying to understand splinter functionalities, i tried to find on web but i couldn't found good documentation with pratical examples on splinter so i asked few questions here so that it will help beginner who are trying to learn splinter : First i am confuse what is actual css selector in splinter , there are two method i see everywhere : browser.find_by_css() or browser.find_by_css_selector() What is the difference between them and why the second one is not working in current splinter ?

How select class , div , tag in splinter?

梦想与她 提交于 2019-12-06 16:13:55
I am trying to understand splinter functionalities, i tried to find on web but i couldn't found good documentation with pratical examples on splinter so i asked few questions here so that it will help beginner who are trying to learn splinter : First i am confuse what is actual css selector in splinter , there are two method i see everywhere : browser.find_by_css() or browser.find_by_css_selector() What is the difference between them and why the second one is not working in current splinter ? Now My original question is how to select any tag which is under any class , how to select any tag

how to open two tabs in python splinter

拈花ヽ惹草 提交于 2019-12-06 06:22:55
from splinter import Browser with Browser() as browser: browser.visit('https://google.com/') browser.visit('http://www.bing.com/') browser.windows[0] browser.windows[1] How to open two tabs in python splinter and change tab? import time from splinter import Browser from selenium.webdriver.common.keys import Keys with Browser() as browser: # visit fst url browser.visit('https://google.com/') # open new tab browser.driver.find_element_by_tag_name('body').send_keys(Keys.CONTROL + 't') # visit second url browser.visit('https://www.bing.com/') # switching between tabs browser.driver.find_element_by

Get href value in Splinter?

本小妞迷上赌 提交于 2019-12-05 00:09:39
问题 I would like to get href value from <a> element in Splinter. Is there any api method for that? 回答1: If you are selecting elements using the find_by_* methods, instances returned by these are ElementLists. After you select the element you are interested in (most probably an ElementAPI instance), access the property like a dictionary: the_element['href'] 回答2: #simplest possible working example demonstrating this in action import splinter b = splinter.Browser() b.visit("http://www.google.com")