selenium

Java Selenium webdriver expression finding dynamic element by ccs that starts with and ends with

▼魔方 西西 提交于 2021-02-13 17:34:31
问题 I have the below HTML element that I need to find. Now, this "id" name is dynamic in the way that the int "0" at the end will change, but I know what it will be. The first int in "0-0" will also change, but it doesn't matter what it will be. <div id="ui-select-choices-row-0-0"> I've tried the below code that looks for an element that starts with "#ui-select-choices-row-" and ends with the desired input of "int", but it's not finding it as expected. Any suggestions on what I'm doing wrong here

Java Selenium webdriver expression finding dynamic element by ccs that starts with and ends with

╄→尐↘猪︶ㄣ 提交于 2021-02-13 17:34:25
问题 I have the below HTML element that I need to find. Now, this "id" name is dynamic in the way that the int "0" at the end will change, but I know what it will be. The first int in "0-0" will also change, but it doesn't matter what it will be. <div id="ui-select-choices-row-0-0"> I've tried the below code that looks for an element that starts with "#ui-select-choices-row-" and ends with the desired input of "int", but it's not finding it as expected. Any suggestions on what I'm doing wrong here

How to bypass being rate limited ..HTML Error 1015 using Python

徘徊边缘 提交于 2021-02-13 17:34:01
问题 So i have created an automation bot to do some stuff for me on the internet .. Using Selenium Python..After long and grooling coding sessions ..days and nights of working on this project i have finally completed it ...Only to be randomly greeted with a Error 1015 "You are being rate limited". I understand this is to prevent DDOS attacks. But it is a major blow. I have contacted the website to resolve the matter but to no avail ..But the third party security software they use says that they

Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided using GeckoDriver

有些话、适合烂在心里 提交于 2021-02-13 17:30:54
问题 from selenium import webdriver; browser= webdriver.Firefox(); browser.get('http://www.seleniumhq.org'); When I try to run this code, it gives me an error message : Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line. Any thoughts-highly appreciated! 回答1: This error message... Expected browser binary location, but unable to find binary in default location, no 'moz

How to bypass being rate limited ..HTML Error 1015 using Python

冷暖自知 提交于 2021-02-13 17:30:11
问题 So i have created an automation bot to do some stuff for me on the internet .. Using Selenium Python..After long and grooling coding sessions ..days and nights of working on this project i have finally completed it ...Only to be randomly greeted with a Error 1015 "You are being rate limited". I understand this is to prevent DDOS attacks. But it is a major blow. I have contacted the website to resolve the matter but to no avail ..But the third party security software they use says that they

How to Change a html line code with python

为君一笑 提交于 2021-02-13 17:29:53
问题 I'd like to change this line: <button _ngcontent-c19="" class="blue-button-disabled" disabled="">CONTINUE </button> to this: <button _ngcontent-c19="" class="blue-button">CONTINUE </button> all that I could do is change the class name from blue-button-disabled to blue-button, but I couldn't remove disabled="" I used this code to achieve that result: driver.execute_script("arguments[0].setAttribute('class','blue-button')", element) 回答1: To remove the attribute disabled="" you can use the

web端自动化——Selenium3+python自动化(3.7版本)-chrome67环境搭建

故事扮演 提交于 2021-02-13 14:04:38
前言 目前selenium版本已经升级到3.0了,网上的大部分教程是基于2.0写的,所以在学习前先要弄清楚版本号,这点非常重要。本系列依然以selenium3为基础。 一、selenium简介 Selenium 是用于测试 Web 应用程序用户界面 (UI) 的常用框架。它是一款用于运行端到端功能测试的超强工具。您可以使用多个编程语言编写测试,并且 Selenium 能够在一个或多个浏览器中执行这些测试。 Selenium的发展经历了三个阶段,第一个阶段,也就是selenium1的时代,在运行selenium1.0程序之前,我们得先启动selenium server 端(selenium remote control),我们简称RC。RC主要包括三个部 分:launcher,http proxy,selenium core。其中selenium core是被selenium server嵌入到浏览器页面中的,selenium core内部是一堆javascript函数构成,通过调用这些函数来实现对浏览器的各种操作。 很显然比较繁琐,这并不是最佳自动化解决方案,于是后来有了webdriver。 selenium2 的时代合并了webdriver,也就是我们通常说的selenium,selenium2是默认支持Firefox浏览器的,这点非常方便。当然也支持其他更多浏览器

练习抓取淘宝商品信息

怎甘沉沦 提交于 2021-02-13 11:53:38
##准备 查看淘宝的页面是不是静态页面,结果是静态页面。 想要抓取的是淘宝搜索某个商品的信息,所以要找到淘宝的搜索接口,经过观察可以看到接口可以这样解决: word = '书包' url = 'https://s.taobao.com/search?q=' + word 其实抓取淘宝主要是想加强自己对正则表达式的理解与运用的,于是决定用requests+re来完成此次练习。 ##调试 ####抓取网页 调试的第一步获取网页的源代码就遇到了问题,真是不幸。于是开始痛苦的调试过程: 在头部信息中添加浏览器信息 结果:失败 在头部信息中添加referer 结果:失败 在头部信息中添加cookie 结果:返回结果有了变化,于是很高兴的去把requests发起的请求改成session会话发起的请求,结果最后发现虽然和以前返回的内容变了,但源代码还是错误的,简直崩溃,不知道用了什么反爬虫技术。 终极武器----selenium 用这个直接调用真实的浏览器对其访问,终于不会出错了(这还是要出错,真的是无fuck可说了),但这个要启动浏览器,速度可能会很慢,所以我把源代码保存到了本地,避免重复访问浪费时间。 保存网页 保存的话用二进制的形式保存,不会出现一些乱七八糟的编码错误,而且用浏览器打开的时候可以显示中文,但用Python读取的时候,显示不出来中文,需要解码才能显示中文

selenium.common.exceptions.TimeoutException while invoking .click() on an element through expected_conditions

荒凉一梦 提交于 2021-02-13 05:45:19
问题 Using python, chromedriver and Windows. I've working on a script for some months which uses .click() function regularly, few days ago it stopped working anywhere on the site. I've been trying to locate the element by id, xpath, etc... or even click it by send_keys(Keys.ENTER) with no success. I'm just trying to click the login icon but nothing happens. Seems to find the element and even click it, but nothing happens. This is the site and here the code: browser = webdriver.Chrome(chrome

selenium.common.exceptions.TimeoutException while invoking .click() on an element through expected_conditions

☆樱花仙子☆ 提交于 2021-02-13 05:43:47
问题 Using python, chromedriver and Windows. I've working on a script for some months which uses .click() function regularly, few days ago it stopped working anywhere on the site. I've been trying to locate the element by id, xpath, etc... or even click it by send_keys(Keys.ENTER) with no success. I'm just trying to click the login icon but nothing happens. Seems to find the element and even click it, but nothing happens. This is the site and here the code: browser = webdriver.Chrome(chrome