webdriver

揭开WebDriver面纱

时间秒杀一切 提交于 2020-05-06 03:15:33
经过一段时间的磨合,决定把WebDriver应用到实际项目中,写一个下单的脚本,途中也算是经历了些风雨,希望能见彩虹。 一、在Eclipse中安装TestNG 使用在线安装总是不成功,到官网下载安装包又提示没有权限,折腾了好几天,终于在网上找了个能用的安装包,安装成功。 二、报cannot instantiate the type select 脚本中本来是用select来找到下拉框的,可是却一直报这个错,后来才发现是少了个报,import就行了org.openqa.selenium.support.ui.Select 三、Element is not currently visible and so may not be interacted with Command duration or timeout: 10.09 seconds 下拉框总是找不到元素,发现项目是鼠标停留就可以出现选项的,使用了鼠标停留的方法,成功找到 Actions builder1 = new Actions(driver); builder1.moveToElement(driver.findElement(By.xpath("//*[@id='order_step2']/div[2]/table/tbody/tr[3]/td[2]/div/div"))); driver.findElement(By

python selenium scrape the whole table

断了今生、忘了曾经 提交于 2020-04-30 16:36:18
问题 The purpose of this code is to scrape a data table form a some links then turn it into a pandas data frame. The problem is that this code only scrapes the first 7 rows only which are in the first page of the table and I want to capture the whole table. so when i tried to loop over table pages, i got an error. Here is the code: from selenium import webdriver urls = open(r"C:\Users\Sayed\Desktop\script\sample.txt").readlines() for url in urls: driver = webdriver.Chrome(r"D:\Projects\Tutorial

python selenium scrape the whole table

a 夏天 提交于 2020-04-30 16:35:32
问题 The purpose of this code is to scrape a data table form a some links then turn it into a pandas data frame. The problem is that this code only scrapes the first 7 rows only which are in the first page of the table and I want to capture the whole table. so when i tried to loop over table pages, i got an error. Here is the code: from selenium import webdriver urls = open(r"C:\Users\Sayed\Desktop\script\sample.txt").readlines() for url in urls: driver = webdriver.Chrome(r"D:\Projects\Tutorial

Download recorded video of UI test case from Zalenium/Selenium

戏子无情 提交于 2020-04-30 07:23:06
问题 I've setup a Zalenium in Kubernates (in the cloud not local minikube or anything else), It works perfectly and everything is OK. When I run a test case with recordVideo capability on, Zalenium records the test and stores a video inside a container, I can access the video via Zalenium's dashboard, but I want to download the video programmatically (not by visiting the dashboard) by RemoteWebDriver or something else, the video's name is dynamically generated and it consists of sessionId (known)

Download recorded video of UI test case from Zalenium/Selenium

泄露秘密 提交于 2020-04-30 07:20:17
问题 I've setup a Zalenium in Kubernates (in the cloud not local minikube or anything else), It works perfectly and everything is OK. When I run a test case with recordVideo capability on, Zalenium records the test and stores a video inside a container, I can access the video via Zalenium's dashboard, but I want to download the video programmatically (not by visiting the dashboard) by RemoteWebDriver or something else, the video's name is dynamically generated and it consists of sessionId (known)

How to make automated test scripts in protractor wait, until the page is loaded fully

自闭症网瘾萝莉.ら 提交于 2020-04-29 09:55:23
问题 No, but really! I know this generic question has been asked thousands of times, but there is something more specific that looks feasible to me and thus I want to know how to achieve it The problem I'm testing an angular app with protractor. Inside the app I want to verify that when I click a link I'm being redirected to the right page (non-angular). The problem is that until I reach the page I'm verifying, the url changes 3 times or so (there are multiple redirections happening), so I can't

How to make automated test scripts in protractor wait, until the page is loaded fully

安稳与你 提交于 2020-04-29 09:55:11
问题 No, but really! I know this generic question has been asked thousands of times, but there is something more specific that looks feasible to me and thus I want to know how to achieve it The problem I'm testing an angular app with protractor. Inside the app I want to verify that when I click a link I'm being redirected to the right page (non-angular). The problem is that until I reach the page I'm verifying, the url changes 3 times or so (there are multiple redirections happening), so I can't

使用WebDriver遇到的那些坑

允我心安 提交于 2020-04-22 04:00:01
‍ 在做web项目的 自动化 端到端 测试 时主要使用的是 Selenium ? WebDriver 来驱动浏览器。 Selenium WebDriver 的优点是支持的语言多,支持的浏览器多。主流的浏览器Chrome、Firefox、IE等都支持,手机上的浏览器Android、IPhone等也支持,甚至还支持PhantomJS(由于PhantomJS跑 测试 时并不需要渲染元素,所以执行速度快)。 使用 WebDriver 遇到的那些坑 webdriver 实用干货 但是我在使用 Selenium WebDriver 时,遇到了很多坑。这些问题,有的是因为 Selenium WebDriver 与浏览器不同版本之间兼容性的问题,有的是 Selenium WebDriver 本身的bug,当然也不乏自己对 Selenium WebDriver 某些 功能 理解不透彻。我花时间总结了一下,分享给大家,希望大家以后遇到问题可以避过这些坑,少走弯路。另外也总结了一些使用 WebDriver 的比较好的实践,也一并分享给大家。 WebDriver 每次启动一个Firefox的实例时,会生成一个匿名的profile,并不会使用当前Firefox的profile。这点一定要注意。比如如果访问被 测试 的web服务需要通过代理,你想直接设置Firefox的代理是行不通的,因为 WebDriver

Selenium not finding element by XPath (although visible in browser)

徘徊边缘 提交于 2020-04-18 05:46:27
问题 So I'm trying to get the left bar of this website: https://experience.arcgis.com/experience/685d0ace521648f8a5beeeee1b9125cd to get the current WHO coronavirus data. I'm locating the countries by Xpath, my code is: from selenium import webdriver import time driver = webdriver.Firefox() driver.get("link_to_the_page") time.sleep(30) countries = country = "/html/body/div/div/div[2]/div/div/div/margin-container/full-container/div[10]/margin-container/full-container/div/div[2]/nav/span/div/div/p

SyntaxError: invalid syntax with executable_path in ipython

99封情书 提交于 2020-04-18 03:50:26
问题 I am using selenium web driver for an assignment in Python. I am getting a syntax error. I am using google colab and Python 3. Here is my code import time from selenium import webdriver driver = webdriver.Chrome (r "C:\Users\Anisha\Downloads\chromedriver.exe") time.sleep(20) I am getting error File "<ipython-input-28-7654fa692ce2>", line 1 driver = webdriver.Chrome (r "C:\Users\Anisha\Downloads\chromedriver.exe") ^ SyntaxError: invalid syntax Please help I am not getting where I am wrong. 回答1