Skip to content

Commit

Permalink
Improved testing, added browser startup, removed filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
iiLaurens committed May 25, 2018
1 parent 9c370da commit 70c2fbd
Show file tree
Hide file tree
Showing 30 changed files with 11,533 additions and 325 deletions.
Empty file removed __init__.py
Empty file.
17 changes: 11 additions & 6 deletions examples/look_for_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@

import sqlite3
from selenium.webdriver.chrome.options import Options
from selenium import webdriver
import os
from urlsave.parser import Parser
from urlsave import Parser, Browser
from datetime import datetime
from json import dumps

Expand Down Expand Up @@ -52,7 +51,7 @@ def create_browser_session():

chrome_driver = 'c:\Windows\chromedriver.exe'

driver = webdriver.Chrome(chrome_options=chrome_options,
driver = Browser(chrome_options=chrome_options,
executable_path=chrome_driver)

return driver
Expand Down Expand Up @@ -121,9 +120,15 @@ def update_db(conn, joblist):
conn.commit()

def main():
driver = create_browser_session()
joblist = get_joblist(driver)
driver.quit()
chrome_options = Options()
chrome_options.add_argument("--window-size=1920x1080")
chrome_options.add_argument("--disable-infobars")

chrome_driver = 'c:\Windows\chromedriver.exe'

with Browser(chrome_options=chrome_options, executable_path=chrome_driver) as driver:
joblist = get_joblist(driver)


conn = connect_db("D:/Temp/db.sqlite")
update_db(conn, joblist)
Expand Down
4 changes: 4 additions & 0 deletions tests/jobs/filter_on_ability.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Save:
Group by: //div[@class="pokemon-info" and contains(., "Normal")]
Keys: /h5
Save: //div[@class="abilities"]/span -l
3 changes: 3 additions & 0 deletions tests/jobs/filter_on_pure_normal.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Save:
Group by: //div[@class="pokemon-info" and contains(., "Normal") and count(.//div)=1]
Save: /h5
4 changes: 4 additions & 0 deletions tests/jobs/pokemon_keys_to_abilities.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Save:
Group by: //div[@class="pokemon-info"]
Keys: /h5
Save: //div[@class="abilities"]/span -l
5 changes: 5 additions & 0 deletions tests/jobs/pokemon_keys_to_details.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Save:
Group by: //div[@class="pokemon-info"]
Keys: /h5
id: /p[@class="id"]
abilities: //div[@class="abilities"]/span
3 changes: 3 additions & 0 deletions tests/jobs/pokemon_keys_to_numbers_no_grouping.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Save:
Keys: //div[@class="pokemon-info"]/h5
Save: //div[@class="pokemon-info"]/p[@class="id"]
1 change: 1 addition & 0 deletions tests/jobs/simple_save.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Save: //div[@class="pokemon-info"]/h5
5 changes: 5 additions & 0 deletions tests/jobs/simple_save_details.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Save:
Group by: //div[@class="pokemon-info"]
name: /h5
id: /p[@class="id"]
abilities: /div[@class="abilities"]/span
1 change: 1 addition & 0 deletions tests/jobs/unique_abilities.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Save: //div[@class="abilities"]/span -u
Loading

0 comments on commit 70c2fbd

Please sign in to comment.