I'm trying to take screenshots of some webpages. I opted for selenium and firefox. I'm using xvfb and setting an environment variable for the display.
The script works fine without xvfb on OS X desktop. However on the server the script hangs after webdriver.Firefox() is issued as if the python script is no longer executing. No exception is ever raised and firefox is still active in my process list.
Setup:
sudo Xvfb :10 -ac
export DISPLAY=:10
test.py
from selenium import webdriver
print 'start'
firefox = webdriver.Firefox()
print 'Hello?'
firefox.quit()
print 'done!'
output:
start
cursor winks tauntingly
I Had the same problem with Chrome. Also tried the phantomJs flash fork, this was successful but did not capture flash content.
starting independently firefox gives
(process:3278): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' f failed
Xlib: extension "RANDR" missing on display ":10".
Error: Access was denied while trying to open files in your profile directory.
ALSA lib confmisc.c:768:(parse_card) cannot find card '0'
ALSA lib conf.c:4248:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4248:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name
ALSA lib conf.c:4248:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4727:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM default
(firefox:3278): GConf-WARNING **: Client failed to connect to the D-BUS daemon:
//bin/dbus-launch terminated abnormally without any error message
Please help
Thanks!
Related
getting error : WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally. (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed
getting above error while running a robot script:
It is a simple code to open you tube in chrome browser.
it looks like this:
*** Settings ***
Library SeleniumLibrary
*** Variables ***
${Browser} Chrome
${URL} https://www.youtube.com/
*** Test Cases ***
TC1
Open Browser ${URL} ${Browser}
Input Text name:search_query ted talk
Click Button id:search-icon-legacy
It is on ubuntu
using python2.7
robotframework==3.0.2
robotframework-mqttlibrary==0.7.0
robotframework-selenium2library==1.8.0
robotframework-seleniumlibrary==4.3.0
ChromeDriver 80.0.3987.106
I tried updating chrome and chrome driver also.
I don't know what am i doing wrong,
please help.
You are trying with robotframework-seleniumlibrary==4.3.0 & robotframework==3.0.2
Update the robotframework-seleniumlibrary 4.3.0 to 3.0.1
pip install robotframework-seleniumlibrary==3.0.1
Add capabilities
${chrome_options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys, selenium.webdriver
Call Method ${chrome_options} add_experimental_option w3c ${False}
Call Method ${chrome_options} add_argument no-sandbox
Call Method ${chrome_options} add_argument disable-setuid-sandbox
Call Method ${chrome_options} add_argument disable-dev-shm-usage
Call Method ${chrome_options} add_argument disable-single-click-autofill
Wait Until Keyword Succeeds 2x 1s
... Create WebDriver Chrome alias=${Browser} chrome_options=${chrome_options}
Go To ${URL}
Input Text name:search_query ted talk
Click Button id:search-icon-legacy
I just installed shiny server and I get an error when I load the shiny web page:
An error has occurred. The application failed to start shows on the right side of the screen.
Then I checked the log and shows:
su: ignore --preserve-environment, it's mutually exclusive to --login.
Fatal error: unable to open the base package
When I type su - shiny and I try to run R I also get the Fatal error: unable to open the base package, so I guess there is a problem with R.
I can load R when I'm root or R user and apparently R works fine.
Any idea? Could it be a PATH problem? If yes, I couldn't find it out.
Thanks in advance.
I set up a celery environment and released two tasks. One is to open Google Chrome, and the other is a simple addition calculation. There is no problem with the function of addition calculation, but the function of opening the browser reports an error, and the browser cannot be opened.
The error:
File
"d:\software\professional\python27\lib\site-packages\selenium\webdriver\common\service.py",
line 95, in start
(os.path.basename(self.path), self.start_error_message, str(e))) WebDriverException: Message: The executable chromedriver needs to be
available in the path. Please see
https://sites.google.com/a/chromium.org/chromedriver/home
set_nonblocking() on a file object with no setblocking() method
(Windows pipes don't support non-blocking I/O)
enter image description here
my code:(tasks.py)
# -*- coding:utf-8 -*-
from selenium import webdriver
import time
from proj.celery import app
import os
#app.task
def chrome_test():
chrome_options = webdriver.ChromeOptions()
driver_path1 = r"chromedriver"
driver_path2 = os.path.join(r"D:\SoftWare\Professional\ChromeDriver", "chromedriver.exe")
# print "try to open chrome..."
driver = webdriver.Chrome(executable_path=driver_path1, options=chrome_options)
# executable_path=driver_path, options=chrome_options
print "open chrome success"
driver.get("https://www.baidu.com/")
time.sleep(1)
print driver
driver.close()
return "success to open chrome..."
#app.task
def add(x, y):
time.sleep(1)
return x+y
if __name__ == "__main__":
chrome_test()
But if I run the function alone, it can work very well.
This error message...
File "d:\software\professional\python27\lib\site-packages\selenium\webdriver\common\service.py", line 95, in start (os.path.basename(self.path), self.start_error_message, str(e)))
WebDriverException: Message: The executable chromedriver needs to be available in the path. Please see https://sites.google.com/a/chromium.org/chromedriver/home set_nonblocking() on a file object with no setblocking() method (Windows pipes don't support non-blocking I/O)
...implies that your program was unable to locate the ChromeDriver while trying to initiate/spawn a new Browsing Context i.e. Chrome Browser session.
In your code block you have used:
driver = webdriver.Chrome(executable_path=driver_path1, options=chrome_options)
Where,
driver_path1 = r"chromedriver"
Hence, your program can't locate the chromedriver.exe.
Solution
You need to mention the absolute path of the ChromeDriver as follows:
driver = webdriver.Chrome(executable_path=r'D:\SoftWare\Professional\ChromeDriver\chromedriver.exe', options=chrome_options)
Alternatively, using os.path.join() you can use:
driver_path2 = os.path.join(r"D:\SoftWare\Professional\ChromeDriver", "chromedriver.exe")
driver = webdriver.Chrome(executable_path=driver_path2, options=chrome_options)
References
You can find a couple of relevant discussions in:
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH error with Headless Chrome
WebDriverException: Message: 'chromedriver' executable needs to be in PATH while setting UserAgent through Selenium Chromedriver Phyton
Error Message: 'chromedriver' executable needs to be PATH
tl; dr
Non-blocking read on a subprocess.PIPE in python
I was add the parameter "-P eventlet" when starting the "celery" service. I encountered this problem, and then I removed the parameter and the problem was solved.
celery -A proj worker -l info -P eventlet (old)
celery -A proj worker -l info
I suspect there is a threading issue between windows and "-P eventlet" and celery. The specific reason is not clear.
I am trying to build Tensorboard (1.13.1) from source. I am using Bazel version 0.26.0 (built from source) and JDK version 11.0.3. I am getting following error during build:
# bazel build --incompatible_disallow_filetype=false --incompatible_bzl_disallow_load_after_statement=false tensorboard
Starting local Bazel server and connecting to it...
ERROR: /root/.cache/bazel/_bazel_root/4e113d18791d4c114d32fe59cdd54b1a/external/io_bazel_rules_closure/closure/compiler/closure_js_library.bzl:343:17: Traceback (most recent call last):
File "/root/.cache/bazel/_bazel_root/4e113d18791d4c114d32fe59cdd54b1a/external/io_bazel_rules_closure/closure/compiler/closure_js_library.bzl", line 335
rule(implementation = _closure_js_lib..., <2 more arguments>)
File "/root/.cache/bazel/_bazel_root/4e113d18791d4c114d32fe59cdd54b1a/external/io_bazel_rules_closure/closure/compiler/closure_js_library.bzl", line 343, in rule
attr.label_list(cfg = "data", allow_files = True)
cfg must be either 'host' or 'target'.
ERROR: error loading package '': in /root/.cache/bazel/_bazel_root/4e113d18791d4c114d32fe59cdd54b1a/external/io_bazel_rules_closure/closure/defs.bzl: Extension file 'closure/compiler/closure_js_library.bzl' has errors
ERROR: error loading package '': in /root/.cache/bazel/_bazel_root/4e113d18791d4c114d32fe59cdd54b1a/external/io_bazel_rules_closure/closure/defs.bzl: Extension file 'closure/compiler/closure_js_library.bzl' has errors
INFO: Elapsed time: 14.290s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
If I search and replace the word 'data' with 'host' from .bzl files, I start getting another error:
# bazel build --incompatible_disallow_filetype=false --incompatible_bzl_disallow_load_after_statement=false tensorboard
ERROR: error loading package '': in /root/.cache/bazel/_bazel_root/4e113d18791d4c114d32fe59cdd54b1a/external/org_tensorflow/tensorflow/workspace.bzl: Label '#org_tensorflow//third_party:nccl/nccl_configure.bzl' crosses boundary of subpackage '#org_tensorflow//third_party/nccl' (perhaps you meant to put the colon here: '#org_tensorflow//third_party/nccl:nccl_configure.bzl'?)
ERROR: error loading package '': in /root/.cache/bazel/_bazel_root/4e113d18791d4c114d32fe59cdd54b1a/external/org_tensorflow/tensorflow/workspace.bzl: Label '#org_tensorflow//third_party:nccl/nccl_configure.bzl' crosses boundary of subpackage '#org_tensorflow//third_party/nccl' (perhaps you meant to put the colon here: '#org_tensorflow//third_party/nccl:nccl_configure.bzl'?)
INFO: Elapsed time: 15.377s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
Correcting the error by replacing,
load("//third_party:nccl/nccl_configure.bzl", "nccl_configure")
by
load("//third_party/nccl:nccl_configure.bzl", "nccl_configure")
in the cache file,
/root/.cache/bazel/_bazel_root/4e113d18791d4c114d32fe59cdd54b1a/external/org_tensorflow/tensorflow/workspace.bzl
Solves the error but now getting this error:
# bazel build --incompatible_disallow_filetype=false --incompatible_bzl_disallow_load_after_statement=false tensorboard
ERROR: /root/.cache/bazel/_bazel_root/4e113d18791d4c114d32fe59cdd54b1a/external/org_tensorflow/tensorflow/workspace.bzl:18:1: file '#io_bazel_rules_closure//closure:defs.bzl' does not contain symbol 'filegroup_external'
ERROR: error loading package '': Extension file 'tensorflow/workspace.bzl' has errors
ERROR: error loading package '': Extension file 'tensorflow/workspace.bzl' has errors
INFO: Elapsed time: 1.113s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
Now I am stuck. Any pointers highly appreciated!
I am following the tutorials to create a react app using create-react-app.
There were a number of dependencies that didn't get installed when loading the webpack-dev-server.
I get the following error when I try to npm run start.
What does this mean and can anyone tell me what is needed to fix it?
Module build failed: Error: Couldn't find preset "react-app" relative to directory "/[Proeject folder]/frontend"
run npm install babel-preset-react-app