Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import driver as driver
- import pandas as pd
- import webdriver_manager.chrome
- from selenium.webdriver.chrome.service import Service
- from selenium.webdriver.common.by import By
- from selenium import webdriver
- import time
- from selenium.common.exceptions import TimeoutException
- options = webdriver.ChromeOptions()
- from selenium.webdriver.support import expected_conditions as EC
- #from selenium.webdriver.common.by import By
- from selenium import webdriver
- from selenium.webdriver.support.ui import WebDriverWait
- from selenium import webdriver
- from selenium.webdriver import ActionChains
- from selenium.webdriver.common.keys import Keys
- ###########################################################################################################################################################
- options.add_argument('--start-maximized')
- options.add_experimental_option("detach", True)
- service = Service('driver/chromedriver.exe')
- driver = webdriver.Chrome(service=Service(webdriver_manager.chrome.ChromeDriverManager().install()), options=options)
- driver.get('https://www.betfair.com.au/exchange/plus/en/football-betting-1/15')
- WebDriverWait(driver, 100).until(lambda driver: driver.execute_script('return document.readyState') == 'complete')
- element = WebDriverWait(driver,20).until(lambda driver: driver.find_element(By.CSS_SELECTOR, ".name:nth-child(1) , bf-coupon-table:nth-child(1) tr:nth-child(1) .matched-amount-value"))
- print('h')
- #time.sleep(5)
- scroll = driver.find_element(By.CSS_SELECTOR, ".coupon-page-navigation__label--next")
- driver.execute_script("arguments[0].scrollIntoView();", scroll)
- try:
- driver.find_element(By.CSS_SELECTOR, "#cookie-holder span").click()
- except:
- pass
- from selenium.webdriver.common.by import By
- from selenium.webdriver.support.ui import WebDriverWait
- from selenium.webdriver.support import expected_conditions as EC
- # < Less than—the number on the left is less than the number on the right; 2 < 3
- # > Greater than—the number on the left is greater than the number on the right; 3 > 2
- #driver.find_element(By.XPATH,'//a[contains(@href,"server_export")]').click()
- #css selector link click python selenium
- #https://stackoverflow.com/questions/33155454/how-to-find-an-element-by-href-value-using-selenium-python
- #bf-coupon-page-navigation > ul > li:nth-child(4) > a[href*=/exchange/plus/en/football
- i = 1
- while i < 6:
- try:
- time.sleep(2)
- #time.sleep(random, 3)
- WebDriverWait(driver, 15).until(EC.element_to_be_clickable((By.CSS_SELECTOR, ".name:nth-child(1)")))
- WebDriverWait(driver, 100).until(lambda driver: driver.execute_script('return document.readyState') == 'complete')
- element = WebDriverWait(driver, 20).until(lambda driver: driver.find_element(By.CSS_SELECTOR, ".name:nth-child(1) , bf-coupon-table:nth-child(1) tr:nth-child(1) .matched-amount-value"))
- scroll = driver.find_element(By.CSS_SELECTOR, ".coupon-page-navigation__label--next")
- driver.execute_script("arguments[0].scrollIntoView();", scroll)
- link = driver.find_element_by_css_selector('[href^=http://somelink.com/]')
- WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "bf-coupon-page-navigation > ul > li:nth-child(4) > a")))
- NextStory = WebDriverWait(driver, 15).until(EC.element_to_be_clickable((By.CSS_SELECTOR, 'bf-coupon-page-navigation > ul > li:nth-child(4) > a')))
- link = driver.find_element_by_css_selector('bf-coupon-page-navigation > ul > li:nth-child(4) > a')
- NextStory.click()
- except:
- i = 6
- print('ha gayyy')
- pass
Add Comment
Please, Sign In to add comment