ghostdriver

How can I handle an alert with GhostDriver via Python?

寵の児 提交于 2019-11-29 14:25:59
问题 Problem: The GhostDriver API does not yet support alert handling. There is an acceptable workaround for the time being, which is to inject your own javascript into the page that will handle the alert and store it's text for you. I'm having trouble using this workaround via the python webdriver bindings. It might be related to my novice level understanding of javascript. Here is an example of the workaround I am trying to utilize: https://github.com/detro/ghostdriver/issues/20#issuecomment

Trying to run PhantomJS on OpenShift: cannot patch GhostDriver so that it can bind on the server IP address

吃可爱长大的小学妹 提交于 2019-11-29 12:20:30
tl;dr How to solve version 'GLIBCXX_3.4.15' not found when I cannot be root on the Linux server? I'm tring to use PhantomJS on OpenShift. As explained in this article , PhantomJS GhostDriver binds on localhost only, while on OpenShift, you cannot bind anything on localhost (you need to specify the machine IP address). Paolo Bernardi (the author of the article) shares a patch that fixes PhantomJS, so that it's possible to bind on an IP address. The problem is that the provided patch does not work on my OpenShift server: when running ./phantomjs -v on my patched PhantomJS installation, I catch a

Using Selenium in the background

断了今生、忘了曾经 提交于 2019-11-29 02:09:23
I'm using Selenium and chrome webdriver but when I run scripts it opens a window. Is there any way that it can access the internet without the window popping up? from selenium import webdriver from selenium.webdriver.common.keys import Keys driver = webdriver.Chrome() driver.get("https://ps.rsd.edu/public/") elem = driver.find_element_by_name("account") elem.send_keys("Username") elem2 = driver.find_element_by_name("pw") elem2.send_keys("Password") elem.send_keys(Keys.RETURN) driver.quit() For example, this goes to my school's grade site and puts in a username and password but I want to do

How to Stop the page loading in firefox programmatically?

醉酒当歌 提交于 2019-11-28 21:24:10
I am running several tests with WebDriver and Firefox. I'm running into a problem with the following command: WebDriver.get(www.google.com); With this command, WebDriver blocks till the onload event is fired. While this can normally takes seconds, it can take hours on websites which never finish loading. What I'd like to do is stop loading the page after a certain timeout, somehow simulating Firefox's stop button. I first tried execute the following JS code every time that I tried loading a page: var loadTimeout=setTimeout(\"window.stop();\", 10000); Unfortunately this doesn't work, probably

Custom headers in Phantomjs Selenium WebDriver

倖福魔咒の 提交于 2019-11-28 16:31:43
问题 According to this it is possible now to modify headers. Atm i need to modify Accept-Language in PhantomJS webdriver. This code doesn't work DesiredCapabilities.PHANTOMJS['phantomjs.page.customHeaders.Accept-Language'] = 'ru-RU' driver = webdriver.PhantomJS() Is it possible somehow to configure Phantomjs to send my header? i don't care where: inside ghostdriver, phantomjs or phantomjs-webdriver. 回答1: The latest version (1.9.1) of PhantomJS is release Jun/5/2013. The pull request is merged Jun

HtmlUnitDriver (HtmlUnit) vs GhostDriver (PhantomJS)?

与世无争的帅哥 提交于 2019-11-28 05:18:01
We are in the middle of choosing our headless browser driver solution that will be some implementation of Selenium WebDriver. There is the GhostDriver , which leverages the PhantomJS in the backend on the one side and HtmlUnitDriver which based on HtmlUnit on the other. PhantomJS uses WebKit, the rendering engine of Safari, to render the pages while HtmlUnitDriver uses the Rhino engine which no other browsers use (it's just "simulating" browser behaviour. The last fact considered as a con, because the rendering behavior can differ significantly from the popular browsers. In our opinion,

How to Stop the page loading in firefox programmatically?

心不动则不痛 提交于 2019-11-27 20:59:03
问题 I am running several tests with WebDriver and Firefox. I'm running into a problem with the following command: WebDriver.get(www.google.com); With this command, WebDriver blocks till the onload event is fired. While this can normally takes seconds, it can take hours on websites which never finish loading. What I'd like to do is stop loading the page after a certain timeout, somehow simulating Firefox's stop button. I first tried execute the following JS code every time that I tried loading a

How to run ghostdriver with Selenium using java

纵然是瞬间 提交于 2019-11-27 14:26:37
I want to use phantomJS for some web testing, and I've come across GhostDriver ( https://github.com/detro/ghostdriver ). I've built it using the instructions in the readme and I can run it on a specified port, but I am not sure how to access the web driver from my java code. To clarify, I've seen this example in ruby: caps = { :browserName => "phantomjs", :platform => "LINUX" } urlhub = "http://key:secret@hub.testingbot.com:4444/wd/hub" client = Selenium::WebDriver::Remote::Http::Default.new client.timeout = 120 @webdriver = Selenium::WebDriver.for :remote, :url => urlhub, :desired

How to run webpage code with PhantomJS via GhostDriver (selenium)

大兔子大兔子 提交于 2019-11-27 04:43:58
问题 I looking for ability render pdf with PhantomJS via GhostDriver , not just render pdf. When I use next code, then page normally loaded: from selenium import webdriver driver = webdriver.PhantomJS('./node_modules/phantomjs/bin/phantomjs') driver.set_window_size(1024, 768) driver.get('http://stackoverflow.com') When I use next script via command line https://github.com/ariya/phantomjs/blob/master/examples/rasterize.js then pdf generated perfectly. Now I want execute script like rasterize.js (

HtmlUnitDriver (HtmlUnit) vs GhostDriver (PhantomJS)?

为君一笑 提交于 2019-11-27 00:52:55
问题 We are in the middle of choosing our headless browser driver solution that will be some implementation of Selenium WebDriver. There is the GhostDriver, which leverages the PhantomJS in the backend on the one side and HtmlUnitDriver which based on HtmlUnit on the other. PhantomJS uses WebKit, the rendering engine of Safari, to render the pages while HtmlUnitDriver uses the Rhino engine which no other browsers use (it's just "simulating" browser behaviour. The last fact considered as a con,