I am trying to open website website in google colab using selenium but not able to do so. Installing chrome driver and setting path variable had issues, so I used Kora library. I am able to to execute wd.get('website') successfully and able to print source_code as well. Kindly let me know how to open website. Below is my code
!pip install kora -q
from kora.selenium import wd
wd.get('https://www.google.com')
wd.page_source
You can show the screen by display the wd.
display(wd)
What exactly do you want to do?
Related
I've created a Python script to collect data from different websites using Selenium. On my Windows PC the script works fine and does exactly what it's supose to do. Now I'm trying to make my script run on my Raspberyy Pi. On my PC I use Google Chrome with selenium but ofcourse Chrome is not supported on a Raspberry Pi. Instead I have to use Chromium but I struggle to make this work. I use the following code to start my driver:
import requests
from selenium import webdriver
session_requests = requests.session()
ser = Service(r"/home/pi/Downloads/chromedriver")
op = webdriver.ChromeOptions()
driver = webdriver.Chrome(service=ser, options=op)
With this code I get the following error:
OSError: [Errno 8] Exec format error: '/home/pi/Downloads/chromedriver'
This error is because my chromedriver is for Google Chrome and not Chromium. When I look for the driver for Chromium, it automatically gives me the driver for Google Chrome instead.
I'm using Chromium version 98.0.4758.106. Is there a driver for Chromium or should I look for another solution? I found a work-around to download Google Chrome on my Raspberry Pi, but this does not look like it should be done. Any suggestions are appreciated, thanks in advance!
After a long search I found a solution for my own problem. People from the Raspbian project have compiled a chromium-chromedriver version for the armhf platform and added it to the repo. The following command line will add the Chromium-driver and make it ready to use:
sudo apt-get install chromium-chromedriver
With this solution you will no longer need to give the path to the driver.
Source: https://ivanderevianko.com/2020/01/selenium-chromedriver-for-raspberrypi
I've been trying to login into a website using python sessions requests but really having trouble.
I access the website and retrieve cookies for next requests
successfully,
the thing is there is a popup window with cookie consent.
It will only let me login if I consent I believe(this is the
behaviour in the manual procedure)
I tracked the cookie consent url requests through network tab in
google chrome inspect,
Upon clicking the consent cookie button facebook pixel and google
fundingchoicesmessages urls are called with multiple parameters that
I don't how to generate(yet at least)
The urls:
https://www.facebook.com/tr/...parameters... (called twice)
https://fundingchoicesmessages.google.com/f/...parameters... (called multiple times 5+)
edit:
Have anyone managed to get through this? I've been around this for some days, really didn't want to use selenium cause it seems to take over the mouse and keayboard and I can't continue what I'm doing in my computer.
Any advice?
Selenium Rocks Selenium doesn't take over the mouse/keyboard. It runs smoothly on a dedicated browser window and meanwhile you can continue working.
thanks
Use selenium, see examples below:
install chromedriver W10
linux
sudo apt-get update
sudo apt-get install chromium-chromedriver
pip3 install selenium
fill-username-and-password-using-selenium-in-python
python-selenium-how-to-login-to-a-website-with-a-login-redirect-organization
selenium official documentation
I'm trying to make an app that blocks some acces to certain websites, now i'm stuck thinking how to check the current url. I've tried selenium, but that doesn't work when you change tabs, so i had to try something else. I've been thinking about a chrome addon that checks current url and sends it to my python code, but i don't know how to do it without making any additional server. Any help appreciated.
You can use selenium and web drive manager for this
Install webdrive manager first using
pip install webdrive-manager
Then input the following code
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(ChromeDriverManager().install())
print (driver.current_url)
I am trying to open a link in "tor" using python. I just want to execute the code and it should start to visit that web page.
I haven't tried anything yet because I am new to this field of python. I know only the basics so kindly tolerate me.
You should use Selenium module for tor browser.
Installation
pip install tbselenium
Basic usage
from tbselenium.tbdriver import TorBrowserDriver
with TorBrowserDriver("/path/to/TorBrowserBundle/") as driver:
driver.get('https://check.torproject.org')
Note: TorBrowserDriver does not download Tor Browser Bundle (TBB) for you. You should download, extract TBB and provide its path when you initialize TorBrowserDriver.
Reference: Check
I can load a Selenium Chromedriver extension in python. But I need to login in this extension in order to be able to use it. My question is how can I interact with this extension in order to login within it? The extension namely is the "Hoxx VPN".
Until I have the following code:
chop = webdriver.ChromeOptions()
chop.add_extension("D:/01_PhD/Fogadas/chromeextension/2.2.2_0.crx")
driver = webdriver.Chrome(chrome_options=chop)
Selenium Webdriver can interact with web pages only. Previously I have also tried it but unable to succeed.
See this as reference:
https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/7805
You can use the Opera Webbrowser it's latest version i.e. 70+ having the in-built vpn which can be activated easily by selenium
Github have the required code to operate opera using selenium