PyCharm notes 1

sudo apt update

sudo apt install snapd

sudo snap install pycharm-community --classic

python3 -V


download https://googlechromelabs.github.io/chrome-for-testing/ 

OR 

https://sites.google.com/chromium.org/driver/home?authuser=0


check installed Chrome version with ChroneWebdriver

download properly version 


// Move file to a directory that's already in PATH

sudo mv ~/Downloads/chromedriver /usr/local/bin

// Make file executable

sudo chmod +x /usr/local/bin/chromedriver


INSTALLING SELENIUM ON YOUR PROJECT

To install Selenium on your python project, follow these steps:

Open File > Settings > Project from the PyCharm toolbar

Select the project you want to install Selenium on

Click the tab "Python Interpreter" within the project tab

Click the + symbol to add a new library to the project

Type "Selenium" into the new library search box, select the "Selenium" library and confirm by clicking "install package"


When the installation has finished, close the project settings window.

TESTING THE INSTALLATION

To check that Selenium has been correctly installed into PyCharm, create a new .py file. Next, copy and paste the following code into your file.



from selenium import webdriver

driver = webdriver.Chrome()
driver.maximize_window()
driver.get("https://www.wikipedia.org/")
query = driver.find_element("id", "searchInput")
query.send_keys("Hello World")
query.submit()
print(driver.find_element("id", "firstHeading").text)
assert driver.title == "\"Hello, World!\" program - Wikipedia"
driver.close()


Run this file and check that first, a window is opened and shortly closed, and second, that the output in pycharm contains the text: "Hello, World!" program.



USEFULL URLs

https://alexsl.medium.com/writing-a-price-tracker-in-python-with-selenium-webdriver-d4e7f5f13495


Комментарии

Популярные сообщения из этого блога