I would like to run casperjs from python on zorin os 11. I have researched about that topic but i can not figure it out exactly because there is lack of information as far as i can see. So, how can i do that?
Have you tried the obvious solution? I mean, did you try the following?
import os
os.system('<your ubuntu code>')
For several issues, this 'os' library solve the problem.
Selenium + PhantomJS is your solution (more info http://selenium-python.readthedocs.io/)
from selenium import webdriver
browser = webdriver.PhantomJS()
browser.get("www.yourURL.com")
Related
I am trying to run a simple script to open up a google page on Chromium Edge using Python.
What I have so far is
Import selenium
From selenium import webdriver
Path= “..../msedgedriver.exe”
Driver= webdriver.Edge(executable_path=path)
Driver.get(https://google.com)
Got below error:SessionNotCreatedEcception:session not created from tab crashed(Session info:MicrosoftEdge=91.0.864.41)
Tried several things and searched online but no luck yet.Any help will be much appreciated!
There are some problems in the code you provide, I fixed them and tested it, and it works well. My Edge Version is 91.0.864.41 (Official build) (64-bit).
Below is my sample code and you can also try:
import selenium
from selenium import webdriver
path= "D:\\webdriver\\msedgedriver.exe"
driver= webdriver.Edge(executable_path=path)
driver.get("https://www.google.com/")
Please note to modify the path to you owns and use the absolute path of the WebDriver.
I think it may just be a code problem that causes the error.
If the problem persists, can you please provide more information? Such as what version of selenium are you using and what operating system are you using?
I've boiled my code down to the following:
from selenium import webdriver
from time import sleep
b = webdriver.Firefox()
sleep(10)
b.get('http://www.google.com')
This causes a BrokenPipeError on the b.get call. Is this an error with my environment? Something I'm doing wrong, or a bug?
ENV:
Fedora 27 (64bit)
Firefox Quantum 59.0.2 (64bit)
Python 3.6.5
selenium 3.13.0 (via pip)
geckodriver v0.21.0 from github
Update:
I upgraded my workstation and along with that moved to Fedora 28 with a brand new install of Firefox 61, Python 3.6.5, Selenium 3.13.0, and geckodriver 0.21.0 and I have the same problem with the provided script.
You need to specify the path of the webdriver.exe file
first specify path ='path of your webdriver.exe'
path ='path of your webdriver.exe'
and then b = webdriver.Firefox(path)
I use this method to fix this problem and I call it every time there is a risk for timeout. I hope there is a better solution, but this works for me right now.
def refresh(b):
try:
b.refresh()
except BrokenPipeError:
pass
I am trying to use the Select function in Selenium for Python 3 to help with navigating through the drop down boxes. However, when I try to import org.openqa.selenium.support.ui.Select I get an error message:
"No module named 'org'"
Would appreciate any help on this. I saw there was a similar question posted a few weeks ago but the link to that question is now broken. Thanks!
The path 'org.openqa.selenium.support.ui.Select' is a Java descriptor. In Python, make sure you have the Python Selenium module installed with pip install selenium, and then import it with import selenium.
For the Select function specifically, you can import that with the following
from selenium.webdriver.support.ui import Select
Then you'll be able to use it like this:
select = Select(b.find_element_by_id(....))
I have been struggling to figure out why I keep getting errors trying to use selenium. I'm using a local install of anaconda3 on my /home/user unix drive at the company I work for. I already pip installed selenium, seemingly without issue, but when I try the following:
from selenium import webdriver
driver = webdriver.Firefox()
it fails with the following message:
WebDriverException: Message: Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line
I've tried downloading the most current chromedriver and trying with that, I've tried installing another gecko-driver, I've tried all kinds of things. But nothing is working. I'm happy to provide any amount of additional information, I just want to get this off the ground at some point...
Thank you!
from selenium import webdriver
path = r'C:\yourgeckodriverpath\geckodriver.exe'
driver = webdriver.Firefox(executable_path=path)
Alright, through a combination of the responses to this question, I have figured out what (I think) went wrong. I was using a linux anaconda install on my company's servers, which (I believe) meant my python had no access to a browser driver. The solution was sadly to install anaconda locally, manually download/unzip/install selenium and geckodriver, and then make sure I pass the whole "executable_path=path" parameter to the Firefox method. This didn't work for Chrome for some reason, which I'll assume has something to do with the unchangeable security specifications on my work machine. If any part of this doesn't sound right, feel free to chime in and shed more light on the issue. Thanks!
I'm going to make an application using the Selenium WebDriver (python) and I was having trouble with some of the initial setup. I want to use the page object design pattern so I've been trying to import some materials in this way:
from page_objects import PageObject, PageElementfrom page_objects import PageObject, PageElement
as can bee seen in the documentation here: https://page-objects.readthedocs.io/en/latest/tutorial.html#a-simple-page-object
I'm using PyCharm for development and I've updated selenium and added it to the project interpreter but this import statement still will not work for me. I'm not sure which external module this import relates to or if its just some part of selenium, so any information would be greatly appreciated. Thanks!
That readthedocs is for the page_objects library, the repo for that library can be found here. You need to install that library before you can import it