- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 chrome webdriver selenium 上遇到一个问题,它没有给我更新的内容,它显示了以前的内容,但实际上在单击下一页链接后,新数据会附加到浏览器中,但当我通过驱动程序时,它会像以前一样给我.
网站链接为:www.abc.com
我的目标是提取所有工作链接。但我无法做到这一点,请在这方面帮助我。
job_links = []
per_page = 9
total_jobs = int(driver.find_element_by_css_selector(".search-results-count.total-jobs").text.split("(")[1].split(")")[0])
total_pages = math.ceil(total_jobs / per_page)
for x in range(1, total_pages):
print("Page number: ", x)
jobs_on_page = ""
time.sleep(5)
jobs_on_page = driver.find_elements_by_xpath("//div[@class='module job-card-wrapper col-md-4 col-xs-12 col-sm-6 corporate-regular background-white']")
for job in jobs_on_page:
print("job is:", job)
job_link = job.find_element_by_xpath("./a").get_attribute('href').split("%")[0]
job_links.append(job_link)
# if x != (total_pages - 1):
print("Hello Page: ", x)
element = driver.find_element_by_xpath(
"//div[@class='reinvent-pagination-next']//span[@class='arrow cta-arrow']")
webdriver.ActionChains(driver).move_to_element(element).click(element).perform()
# self.wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@class='reinvent-pagination-next']//span[@class='arrow cta-arrow']"))).click()
time.sleep(10)"
它反复为我提供首页作业链接,但是我的页面在 webdriver 中发生了变化。
最佳答案
引入 WebDriverWait()
和 visibility_of_all_elements_ located
() 并遵循 css 选择器来获取所有链接。
使用无限 while 循环并使用 try.. except 检查下一个按钮是否可用
代码:
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
options = Options()
options.add_argument("start-maximized")
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
driver = webdriver.Chrome(options=options)
driver.get("https://www.boom.com")
Alllinks=[]
while True:
elements=WebDriverWait(driver, 20).until(EC.visibility_of_all_elements_located((By.CSS_SELECTOR, "div.module > a[data-linkcomponentname='jobsearchblock']")))
for link in elements:
Alllinks.append(link.get_attribute('href'))
try :
next_btn=WebDriverWait(driver,10).until(EC.element_to_be_clickable((By.XPATH,'//a[@class="next-page-btn"]')))
driver.execute_script("arguments[0].click();", next_btn)
except:
break
time.sleep(1)
print('Total links :' + str(len(Alllinks)))
print(Alllinks)
输出:
Total links :90
['https://www.boom.com/ca-en/careers/jobdetails?id=00728259_en&title=Sales+Capture+Lead+%e2%80%93+Large-Scale+Consulting%2c+Technology+and+Operations+Sales', 'https://www.boom.com/ca-en/careers/jobdetails?id=00778020_en&title=Business+Operations+Manager', 'https://www.boom.com/ca-en/careers/jobdetails?id=00804572_en&title=Test+Automation+Engineer', 'https://www.boom.com/ca-en/careers/jobdetails?id=00780841_en&title=Consulting+Senior+Manager%2c+Automotive', 'https://www.boom.com/ca-en/careers/jobdetails?id=00788609_en&title=Senior+Integration+Architect', 'https://www.boom.com/ca-en/careers/jobdetails?id=00788884_en&title=E2E+Senior+Tester', 'https://www.boom.com/ca-en/careers/jobdetails?id=00739145_en&title=Oracle+Project+Portfolio+Management+Cloud+Consultant', 'https://www.boom.com/ca-en/careers/jobdetails?id=00777973_en&title=Executive+Assistant', 'https://www.boom.com/ca-en/careers/jobdetails?id=00756315_en&title=Azure+Consultant', 'https://www.boom.com/ca-en/careers/jobdetails?id=00798395_en&title=Technology+Delivery+Lead+Manager', 'https://www.boom.com/ca-en/careers/jobdetails?id=00783770_en&title=SAP+Customer+Manager', 'https://www.boom.com/ca-en/careers/jobdetails?id=00780180_en&title=Oracle+Cloud+integration+Architect', 'https://www.boom.com/ca-en/careers/jobdetails?id=00740026_en&title=Smart+Spend+Manager', 'https://www.boom.com/ca-en/careers/jobdetails?id=00765639_en&title=Hybris+Architect%2fDevelopment+Lead', 'https://www.boom.com/ca-en/careers/jobdetails?id=00765637_en&title=Hybris+Senior+Developer', 'https://www.boom.com/ca-en/careers/jobdetails?id=00801716_en&title=Senior+Cloud+Native+Architect', 'https://www.boom.com/ca-en/careers/jobdetails?id=00762181_en&title=Smart+Spend+Consultant', 'https://www.boom.com/ca-en/careers/jobdetails?id=00752420_en&title=Senior+Cloud+Architect', 'https://www.boom.com/ca-en/careers/jobdetails?id=00785832_en&title=Digital+Technology+Consulting+Senior+Manager', 'https://www.boom.com/ca-en/careers/jobdetails?id=00736712_en&title=Azure+Data+Architect+Manager', 'https://www.boom.com/ca-en/careers/jobdetails?id=00742724_en&title=Client+Financial+Management+Analyst', 'https://www.boom.com/ca-en/careers/jobdetails?id=00789817_en&title=SAP+Sourcing%2fProcurement+Manager', 'https://www.boom.com/ca-en/careers/jobdetails?id=00791760_en&title=SAP+HCM+Manager+-+H%26PS', 'https://www.boom.com/ca-en/careers/jobdetails?id=00782632_en&title=Workday+Integration+Senior+Analyst', 'https://www.boom.com/ca-en/careers/jobdetails?id=00775896_en&title=SAP+SCM+Manager', 'https://www.boom.com/ca-en/careers/jobdetails?id=00752413_en&title=Red+Hat+OpenShift+Cloud+Architect', 'https://www.boom.com/ca-en/careers/jobdetails?id=00759225_en&title=Cloud+Application+Architect', 'https://www.boom.com/ca-en/careers/jobdetails?id=00797835_en&title=SAP+S%2f4+HANA+EAM+Manager', 'https://www.boom.com/ca-en/careers/jobdetails?id=00778099_en&title=Front+Desk+Assistant%2fReception', 'https://www.boom.com/ca-en/careers/jobdetails?id=00734569_en&title=SAP+Payroll+Consultant', 'https://www.boom.com/ca-en/careers/jobdetails?id=00747056_en&title=SAP+Ariba+Delivery+Manager', 'https://www.boom.com/ca-en/careers/jobdetails?id=00684615_en&title=Solutions+Architect%2fManager', 'https://www.boom.com/ca-en/careers/jobdetails?id=00740979_en&title=SAP+IBP+Manager', 'https://www.boom.com/ca-en/careers/jobdetails?id=00594586_en&title=Sales+Capture%2c+Senior+Manager+(Application+Services)', 'https://www.boom.com/ca-en/careers/jobdetails?id=00752409_en&title=Sr+Implementation+Specialist', 'https://www.boom.com/ca-en/careers/jobdetails?id=00784403_en&title=Senior+Technical+Consultant', 'https://www.boom.com/ca-en/careers/jobdetails?id=00778080_en&title=Marketing+Campaign+Manager', 'https://www.boom.com/ca-en/careers/jobdetails?id=00786043_en&title=Microservices%2fJava+Spring+Boot+Developer', 'https://www.boom.com/ca-en/careers/jobdetails?id=00774712_en&title=SAP+S%2f4+Finance+Consultant+-+SAP+Technology', 'https://www.boom.com/ca-en/careers/jobdetails?id=00756729_en&title=SAP+Delivery+Lead+-+SAP+Technology', 'https://www.boom.com/ca-en/careers/jobdetails?id=00758527_en&title=Management+Consulting+Manager+%e2%80%93+Utilities+T%26D+(Toronto)', 'https://www.boom.com/ca-en/careers/jobdetails?id=00789288_en&title=SAP+Finance+Manager+-+Health+and+Public+Services+Sector', 'https://www.boom.com/ca-en/careers/jobdetails?id=00789286_en&title=SAP+Finance+Consultant+-+Health+and+Public+Services+Sector', 'https://www.boom.com/ca-en/careers/jobdetails?id=00752355_en&title=Oracle+Cloud+SCM+Consutant', 'https://www.boom.com/ca-en/careers/jobdetails?id=00733096_en&title=Oracle+Cloud+-+Order+To+Cash+Functional+Consultant', 'https://www.boom.com/ca-en/careers/jobdetails?id=00782656_en&title=Sr+Oracle+Projects+Lead', 'https://www.boom.com/ca-en/careers/jobdetails?id=00756751_en&title=Data+Governance+Senior+Manager', 'https://www.boom.com/ca-en/careers/jobdetails?id=00789201_en&title=Technical+Consultant', 'https://www.boom.com/ca-en/careers/jobdetails?id=00768916_en&title=CI+Functional+Designer+-+Technology+Consultant', 'https://www.boom.com/ca-en/careers/jobdetails?id=00747893_en&title=SAP+S4+HANA+Finance+%e2%80%93+Senior+Manager+(IPT)', 'https://www.boom.com/ca-en/careers/jobdetails?id=00768965_en&title=Data+Engineering+Manager', 'https://www.boom.com/ca-en/careers/jobdetails?id=00721462_en&title=AEM+Architect', 'https://www.boom.com/ca-en/careers/jobdetails?id=00754980_en&title=Sales+Capture+Senior+Manager+-+Financial+Services', 'https://www.boom.com/ca-en/careers/jobdetails?id=00791449_en&title=Azure+Cloud+Operations+Lead', 'https://www.boom.com/ca-en/careers/jobdetails?id=00779191_en&title=Workday+Data+Consultant', 'https://www.boom.com/ca-en/careers/jobdetails?id=00785754_en&title=Organization+Change+Senior+Manager', 'https://www.boom.com/ca-en/careers/jobdetails?id=00752384_en&title=Full+Stack+Developer', 'https://www.boom.com/ca-en/careers/jobdetails?id=00766888_en&title=Oracle+Cloud+ERP+-+Business+Lead', 'https://www.boom.com/ca-en/careers/jobdetails?id=00770105_en&title=SAP+Finance+Manager', 'https://www.boom.com/ca-en/careers/jobdetails?id=00788292_en&title=Systems+Engineer+(Azure%2c+Cloud+%26+O365)', 'https://www.boom.com/ca-en/careers/jobdetails?id=00755903_en&title=Cloud+Engineer+Consulting+Manager', 'https://www.boom.com/ca-en/careers/jobdetails?id=00749401_en&title=Azure+Cloud+Architect', 'https://www.boom.com/ca-en/careers/jobdetails?id=00768544_en&title=Cloud+Native+Developer', 'https://www.boom.com/ca-en/careers/jobdetails?id=00773267_en&title=Global+Category+Management+Associate+Manager+(Canada)', 'https://www.boom.com/ca-en/careers/jobdetails?id=00752415_en&title=Pivotal+Cloud+Foundry+Developer', 'https://www.boom.com/ca-en/careers/jobdetails?id=00763409_en&title=Mulesoft+Architect', 'https://www.boom.com/ca-en/careers/jobdetails?id=00775495_en&title=Consulting+Manager+-+Contact+Center+Strategy+(Retail+Banking)', 'https://www.boom.com/ca-en/careers/jobdetails?id=00780965_en&title=SAP+Finance+Transformation+Senior+Manager', 'https://www.boom.com/ca-en/careers/jobdetails?id=00760167_en&title=SAP+Fieldglass+Consultant', 'https://www.boom.com/ca-en/careers/jobdetails?id=00780860_en&title=Oracle+Cloud+SCM+-+Manager', 'https://www.boom.com/ca-en/careers/jobdetails?id=00780864_en&title=Oracle+Cloud+Finance+-+Manager', 'https://www.boom.com/ca-en/careers/jobdetails?id=00751969_en&title=Innovation+and+Best+Practices+(F%26A)+Associate+Director', 'https://www.boom.com/ca-en/careers/jobdetails?id=00781338_en&title=SAP+SuccessFactors+Employee+Central+Consultant', 'https://www.boom.com/ca-en/careers/jobdetails?id=00779384_en&title=Vlocity+%2f+Salesforce+Developer', 'https://www.boom.com/ca-en/careers/jobdetails?id=00744256_en&title=SAP+S%2f4+HANA+Finance+Senior+Manager-+SAP+Technology', 'https://www.boom.com/ca-en/careers/jobdetails?id=00774716_en&title=SAP+Technical+Architect+-+Senior+Leader', 'https://www.boom.com/ca-en/careers/jobdetails?id=00756760_en&title=AWS+Cloud+Architect+Specialist', 'https://www.boom.com/ca-en/careers/jobdetails?id=00769005_en&title=SAP+SuccessFactors+Recruiting+%26+Onboarding+Consultant', 'https://www.boom.com/ca-en/careers/jobdetails?id=00735660_en&title=SAP+SuccessFactors+LMS+Consultant', 'https://www.boom.com/ca-en/careers/jobdetails?id=00736215_en&title=SAP+SuccessFactors+Technical+Solution+Architect', 'https://www.boom.com/ca-en/careers/jobdetails?id=00747061_en&title=SAP+S4+HANA+Supply+Chain+(SCM)+-+Senior+Manager', 'https://www.boom.com/ca-en/careers/jobdetails?id=00747058_en&title=SAP+S4+HANA+Central+Finance+Senior+Manager+-+SAP+Technologies', 'https://www.boom.com/ca-en/careers/jobdetails?id=00776370_en&title=ERP+(SAP%2c+Oracle)+Security+Senior+Manager', 'https://www.boom.com/ca-en/careers/jobdetails?id=00773097_en&title=Organization+Change+Manager', 'https://www.boom.com/ca-en/careers/jobdetails?id=00773095_en&title=Organization+Change+Consultant', 'https://www.boom.com/ca-en/careers/jobdetails?id=00773099_en&title=Organization+Change+Manager', 'https://www.boom.com/ca-en/careers/jobdetails?id=00768546_en&title=Cloud+Native+Senior+Application+Developer', 'https://www.boom.com/ca-en/careers/jobdetails?id=00766506_en&title=Mulesoft+Developer', 'https://www.boom.com/ca-en/careers/jobdetails?id=00748946_en&title=Senior+Software+Engineer%2fTeam+Lead', 'https://www.boom.com/ca-en/careers/jobdetails?id=00334756_en&title=Military+Service+Members+and+Veterans+-+Canada+%2b%2b']
关于python - 基于 ajax 的数据加载后如何获取 Chrome webdriver 的最新内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60055071/
就目前情况而言,这个问题不太适合我们的问答形式。我们希望答案得到事实、引用资料或专业知识的支持,但这个问题可能会引发辩论、争论、民意调查或扩展讨论。如果您觉得这个问题可以改进并可能重新开放,visit
ECharts是一个纯Javascript的图表库,可以流畅的运行在PC和移动设备上,兼容当前绝大部分浏览器,底层依赖轻量级的Canvas类库ZRender,提供直观、生动、可交互、可高度个性化定制
前言 提示:这里可以添加本文要记录的大概内容: 例如:随着人工智能的不断发展,机器学习这门技术也越来越重要,很多人都开启了学习机器学习,本文就介绍了机器学习的基础内容。 提示:以下是本篇文章正文
作为一名ios开发攻城狮,在苹果没有出arc(自动内存管理机制)时,我们几乎有一半的开发时间都耗费在这么管理内存上.后来苹果很人性的出了arc,虽然在很大程度上,帮助我们开发者节省了精力和时间.但是
如何反转Pandas中DataSeries的排序顺序,以便我按降序使用它们? 最佳答案 In [28]: s = pd.Series([20, 10, 30], ['c', 'a', 'b']) In
这个问题已经有答案了: 已关闭10 年前。 Possible Duplicate: Is jQuery $.browser Deprecated? 最新的 jQuery 库是否发生变化 $.brows
我正在开发一个 Intranet 项目,所以我无法复制/粘贴代码,所以希望我的描述和一些小片段会有所帮助。 我知道 MySQL 触发器无法做到这一点,但希望有一种干净的 JPA PrePersist(
这是数据集: 人员状态日期 埃里克 1 1/1/2015 埃里克 2 2/1/2015 埃里克 3 2015 年 3 月 1 日 约翰福音 1 3/1/2015 约翰福音 2 2015 年 2 月 1
现在我正在使用下面的查询按每篇文章的 auto_increment id 排序 mysql_query("SELECT * FROM articles ORDER BY id DESC"); 我想知道
已结束。此问题不符合 Stack Overflow guidelines .它目前不接受答案。 我们不允许提出有关书籍、工具、软件库等方面的建议的问题。您可以编辑问题,以便用事实和引用来回答它。 关闭
已结束。此问题不符合 Stack Overflow guidelines .它目前不接受答案。 我们不允许提出有关书籍、工具、软件库等方面的建议的问题。您可以编辑问题,以便用事实和引用来回答它。 关闭
现在我正在使用下面的查询按每篇文章的 auto_increment id 排序 mysql_query("SELECT * FROM articles ORDER BY id DESC"); 我想知道
在我们做文章的时候常用一些函数修改来实现自己的页面效果,例如,时间的自定义格式 我们常常需要乃至的,搜集了些有关时间格式的CODE,作大家为参考,希望对大家有些帮助 列表页list_article
我想将某些东西提交到 github 存储库,但我(显然)没有任何权利这样做。我对那个 repo 做了一个分支,提交了我的更改并提交了一个 pull-request。 现在,问题是过了一段时间其他人已经
我是 SQL 新手,所以现有的答案对我来说有点复杂。 我有三张 table : WORKER |id |name |date |... JOB |id |name |salary |accept AP
我正在自动从PowerPoint和Excel电子表格中生成PowerPoint报表。在粘贴表格之前,我已经完成了整个过程。 我使用PPApp.CommandBars.ExecuteMso ("Past
我们有 1 个 Kafka 主题和 1 个分区: 从 spring boot kafka 消费者那里看到一个相当奇怪的行为。 Spring kafka消费者在重新启动时总是从主题的开头开始消费。 我已
通过编程从iOS照片库获取最新照片是否有技巧? 我知道我可以按日期搜索,但是我必须每隔一微秒进行一次扫描,以便进行某种比较以准确地找到它。 有没有人做过这个或任何想法? 最佳答案 我之前采取的一种方法
我们上周将 Web 应用程序中的 Telerik Kendo 库从 V2015.2.902 升级到 V2016.1.112。从那时起,我们注意到使用 Kendo 的页面需要很长时间才能加载(30 秒到
我有两个表: STUDENT GRADES ---------- ---------- id id name person_id ad
我是一名优秀的程序员,十分优秀!