When I am launching Chrome browser from python shell using Selenium webdriver, it works well and good. But, when I launch the browser using the same code from inside a Python script, it crashes. How can I solve it?
Okay got it.
The reason was that I was not providing a url after opening the broswer.
We need to provide the url after opening the browser so that it can go to a specific page and it works fine, else it will crash.
Related
In my code i am initially starting firefox browser via command prompt.
I want to connect the firefox webdriver to this already open instance of firefox browser and not open new firefox browser.
How do i implement this in selenium python.
Note:I am able to implement this for other browsers like chrome,edge but i dont find any way of doing it for firefox.
I also refered https://github.com/mozilla/geckodriver/issues/1669 ,but over here i am not sure how this --connect-existing works, it didnt work out for me.
Thanks in advance :)
Repeating the answers in github: there is a flag
--connect-existing
to connect the geckodriver with existing firefox instance.
https://helpmanual.io/help/geckodriver/
This here is a nice tutorial:
https://tarunlalwani.com/post/reusing-existing-browser-session-selenium/
I made a web scrape program using selenium.
This program is access target URL and download a file.
After updating Chrome, program does not work because chromedriver is old version.
How to do web scraping and file download not use chromedriver?
Thank all for reading.
I think it would be easier if you also updated ChromeDriver, that way your program would work again. Or you could install the previous Chrome version again.
But if you don't want that, you can use GeckoDriver with Firefox.
You can use a headless scrapper like Pupeppeteer. You also can update your Chrome driver to be compatible with your browser version that is the most recomended.
Website opened in selenium just stops working after a few seconds but rest of the code works without problem , I tried opening the site in opera as well in chrome but with the same result when I tried to open shorter version of this program in basic Ide it worked without a problem but when I tried to run this version in pycharm it again didnt worked
Code:
from selenium import webdriver
def web(): driver = webdriver.Opera() driver.get('website') web()
my problem is, that I wrote some python scripts, which are working fine. Now I have to get them to work on an ubuntu server. The problem is, that I need to use the chromedriver (selenium) and ofc there cant be an open browser at the server. So is there a way to use selenium with a server?
What you need is called 'Headless' editions of a browser.
These headless browsers don't open up as a browser but run in the background for you to perform scripts on.
Try searching for Headless + 'The browser driver you use'
Here is a quick tutorial to get you started: https://medium.com/#pyzzled/running-headless-chrome-with-selenium-in-python-3f42d1f5ff1d
I have been using Chrome Webdriver along with Selenium/Python to load and save some webpages. It had been working fine. Today Chrome kept crashing as soon as it opened so I downloaded the latest Chrome Webdriver which solved that issue.
However, the following lines did not seem to work any more:
actions = ActionChains(driver)
actions.key_down(Keys.CONTROL).send_keys('s').key_up(Keys.CONTROL).perform()
There was no error returned in the command prompt and all the other keyboard commands that did not use key_down/key_up worked correctly.
I have googled for a while but can't figure out why it is not working any more. Thanks