forked from creativetimofficial/material-dashboard-django
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscrap.py
More file actions
32 lines (28 loc) · 1.1 KB
/
scrap.py
File metadata and controls
32 lines (28 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import requests
from bs4 import BeautifulSoup
from bs4 import BeautifulSoup
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
options = webdriver.ChromeOptions()
options.add_argument('headless')
driver = webdriver.Chrome(options=options)
# log in to Microsoft login
driver.get('https://login.microsoftonline.com/')
email_input = driver.find_element(By.ID,'i0116')
email_input.send_keys('abc@paymob.com')
next_button = driver.find_element(By.ID,'idSIButton9')
next_button.click()
password_input = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, 'i0118')))
password_input.send_keys('abc')
signin_button = driver.find_element(By.ID,'idSIButton9')
signin_button.click()
time.sleep(30) # wait for the page to load
# navigate to the URL
url = 'https://accept-reporting.paymobsolutions.com/anotherpanel/payment_methods/transaction/'
driver.get(url)
# parse the HTML with BeautifulSoup
soup = BeautifulSoup(driver.page_source, 'html.parser')
print(soup)