Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from selenium import webdriver
- from selenium.webdriver.common.keys import Keys
- #!/usr/bin/env python3
- # -*- coding: utf-8 -*-
- """
- Created on Sun May 28 21:26:50 2017
- @author: Pranavtadepalli and houd163
- """
- #if int(ss)>=90: driver.quit()
- #solution=urllib.r equest.urlopen('https://www.wolframalpha.com/input/?i='+problem.replace('×','*')).read()
- #solution=soup(solution)
- #print(solution.find_all(class_="ng-isolate-scope"))
- from selenium import webdriver
- from selenium.webdriver.common.by import By
- from selenium.webdriver.common.keys import Keys
- from selenium.webdriver.support.wait import WebDriverWait
- from selenium.webdriver.support import expected_conditions as EC
- from selenium.webdriver.common.keys import Keys
- import time
- from bs4 import BeautifulSoup as soup
- import urllib.request
- driver = webdriver.Ie("C:\\Users\\agzsc\\Google Drive\\IEDriverServer.exe")
- driver.get('https://www.ixl.com/')
- username = driver.find_element_by_name("username")
- password = driver.find_element_by_name("password")
- username.send_keys("prantadepa@losgatos")
- password.send_keys("17802249")
- driver.find_element_by_id("qlsubmit").click()
- def solveIXL(problem):
- try:
- solution=int(problem.split(':')[1].split(' ')[0])*int(problem.split(':')[1].split(' ')[2])
- except:
- time.sleep(1)
- try:
- solution=int(problem.split(':')[1].split(' ')[0].split('*')[0])*int(problem.split(':')[1].split(' ')[0].split('*')[1])
- except:
- solution=1
- return solution
- for elem in range(25):
- driver.execute_script('''window.open("https://www.ixl.com/math/grade-3/multiply-by-6","_blank");''')
- driver.switch_to_window(driver.window_handles[1+elem])
- source=soup(driver.page_source,'lxml')
- time.sleep(1)
- ss=source.findAll("span", {"id": "currentscore"})[0].get_text()
- ss=int(ss)
- print(ss)
- if ss>=90: driver.quit()
- if 1==1:
- problem = None
- while problem is None:
- try:
- source=soup(driver.page_source,'lxml')
- problem=source.find_all(class_="math")[0].get_text().replace('×','*').replace('\xa0','')
- except:
- driver.execute_script('''location.reload();''')
- solution=solveIXL(problem)
- answer=driver.find_element_by_class_name("fillIn")
- answer.send_keys(solution)
- time.sleep(1)
- try:
- driver.find_elements_by_xpath("//button[contains(text(), 'Submit')]")[1].click()
- except:
- driver.find_elements_by_xpath("//button[contains(text(), 'Submit')]")[0].click()
- time.sleep(0.5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement