阅读背景:

Python+selenium scraping and outputting to excel

来源:互联网 

This is my code :

这是我的代码:

import xlsxwriter
from selenium import webdriver
from selenium.webdriver.common.by import By
chrome_path = r"C:\Users\shoshi\Desktop\אישי\webscraping\chromedriver_win32\chromedriver.exe"
driver = webdriver.Chrome(chrome_path)
driver.get("https://services.cal-online.co.il/Card-Holders/SCREENS/AccountManagement/Login.aspx?ReturnUrl=%2fcard-holders%2fScreens%2fAccountManagement%2fHomePage.aspx")
user = driver.find_element_by_xpath('//*[@id="ctl00_FormAreaNoBorder_FormArea_lgnLogin_UserName"]')
user.send_keys("xxxx")
passwd = driver.find_element_by_xpath('//*[@id="ctl00_FormAreaNoBorder_FormArea_lgnLogin_Password"]')
passwd.send_keys("xxxx")
driver.find_element_by_xpath('//*[@id="ctl00_FormAreaNoBorder_FormArea_lgnLogin_LoginImageButton"]').click()
driver.find_element_by_xpath('//*[@id="LabelPaymentDetails"]').click()
driver.find_element_by_xpath('//*[@id="lnkToggleFormLink"]/span').click()
driver.find_element_by_xpath('//*[@id="ctl00_FormAreaNoBorder_FormArea_rdoAggregationBySector"]').click()
driver.find_element_by_xpath('//*[@id="ctl00_FormAreaNoBorder_FormArea_ctlSubmitRequest"]').click()



driver.find_element_by_xpath('//*[@id="ctl00_FormAreaNoBorder_FormArea_ctlToggleGrid_lnkExpand"]').click()
posts = driver.find_elements_by_id("ctlMainGrid") 
for post in posts:
    print(post.text)
import xlsxwriter



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: