Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions .github/workflows/Selenium-Action_Template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,20 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checking out repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setting up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5

with:
python-version: '3.9'
- name: Installing package list
run: apt list --installed
- name: Removing previous chrome instances on runner
run: sudo apt purge google-chrome-stable

# Need to fetch reqs if needed
- name: Installing all necessary packages
run: pip install chromedriver-autoinstaller selenium pyvirtualdisplay
run: pip install selenium pyvirtualdisplay

- name: Install xvfb
run: sudo apt-get install xvfb

Expand Down
8 changes: 1 addition & 7 deletions Selenium-Template.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
import chromedriver_autoinstaller
from pyvirtualdisplay import Display
display = Display(visible=0, size=(800, 800))
display.start()

chromedriver_autoinstaller.install() # Check if the current version of chromedriver exists
# and if it doesn't exist, download it automatically,
# then add chromedriver to path

chrome_options = webdriver.ChromeOptions()
# Add your options as needed
options = [
Expand All @@ -30,8 +25,7 @@
for option in options:
chrome_options.add_argument(option)


driver = webdriver.Chrome(options = chrome_options)
driver = webdriver.Chrome(service=Service(), options=chrome_options)

driver.get('http://github.com')
print(driver.title)
Expand Down