selenium

Random TimeoutException even after using ui.WebDriverWait() chrome selenium python

梦想与她 提交于 2021-02-11 10:47:31
问题 Random timeout exception for the code below not sure whats the best approach to address these issues, and this timeout not happen all time, and also it does find elements sometime or all time we appreciate your comments and suggestions and apparently explicit wait is not handling until the elements gets loaded into the browser application or elements are getting different interval in every single time when new page gets loaded """ """ import platform , logging import os,re from time import

ValueError: could not convert string to float: '' in python 3

♀尐吖头ヾ 提交于 2021-02-11 09:38:02
问题 So I'm coding a little bot in python and I'm having a problem. It seems to be a common problem, but I've never seen it asked in the same situation I'm in. Ok so here is the code posing problem : old_values = float((removeprc(browser.find_element_by_xpath('//*[@id="draggableNavRightResizable"]/section/section[2]/section[1]/div[3]/ul/li[1]/div[2]/div[6]/span').text))) browser.find_element_by_xpath('//*[@id="draggableNavRightResizable"]/section/section[2]/section[1]/div[3]/ul/li[1]/div[2]/div[6]

Scraping Google Images using Selenium in Python

风格不统一 提交于 2021-02-11 08:44:29
问题 Now, I have been trying to scrape google images using the following code : from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys import os import time import requests import re import urllib2 import re from threading import Thread import json #Assuming I have a folder named Pictures1, the images are downloaded there. def threaded_func(url,i): raw_img = urllib2.urlopen(url).read() cntr = len([i for i in os.listdir("Pictures1"

StaleElementReferenceException even when having explicit wait

孤街浪徒 提交于 2021-02-11 06:52:52
问题 I've been trying to crawl data from the website AlgoExplorer. It has a table with pagnigation to store data. Even though I use an Explicit Wait for clicking a 'next' button, it still get StaleException. Here is a piece of my code, and an image of error: for i in tqdm(range(5)): page = driver.find_element_by_tag_name('tbody').find_elements_by_tag_name('a') for e in page: pages.append(e.text) WebDriverWait(driver, 5).until(EC.element_to_be_clickable((By.CSS_SELECTOR, '.pagination.next'))).click

OpenQA.Selenium.NoSuchElementException: Unable to locate element error while locating an element on a page using Selenium and C#

核能气质少年 提交于 2021-02-11 05:53:33
问题 I am trying to scrape the text 睡觉 within the page edited out the site It has the css selector: #autocplt_wrap > ul:nth-child(1) > li:nth-child(1) > span:nth-child(1) > a:nth-child(1) And x-Path: /html/body/div[2]/div[1]/div[3]/div[2]/div[1]/div/div[1]/div[2]/div/div/ul[1]/li/span/a[1] My code is: IWebDriver driver = new FirefoxDriver(); WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10)); //load webdriver driver.Manage(); driver.Navigate().GoToUrl("https://dict.naver.com

Selenium webdriver problem with: Expected condition failed: waiting for visibility of element located by(..)

守給你的承諾、 提交于 2021-02-11 05:43:18
问题 I have little problem with my automated test. When my test make error: Expected condition failed: waiting for visibility of element located by(...) and I don't know what is problem. @BeforeMethod public void BeforeTest(){ System.setProperty("webdriver.chrome.driver", "C:/drivers/chromedriver.exe"); driver = new ChromeDriver(); driver.manage().window().maximize(); driver.navigate().to("https://poczta.o2.pl/rejestracja/"); } @Test public void Test(){ WebDriverWait wait = new WebDriverWait

How to use default browser profile in Selenium instead of new one? [duplicate]

情到浓时终转凉″ 提交于 2021-02-11 04:52:57
问题 This question already has answers here : Cannot resolve constructor FirefoxDriver(org.openqa.selenium.firefox.FirefoxProfile) (1 answer) webdriver.FirefoxProfile(): Is it possible to use a profile without making a copy of it? (1 answer) Closed 6 days ago . I couldn't find any relevant answers and my question is pretty straight forward. The context isn't really relevant. It is very important for me that Selenium uses my normally installed browser (Chrome or Firefox), when doing coded things.

How to use default browser profile in Selenium instead of new one? [duplicate]

放肆的年华 提交于 2021-02-11 04:51:54
问题 This question already has answers here : Cannot resolve constructor FirefoxDriver(org.openqa.selenium.firefox.FirefoxProfile) (1 answer) webdriver.FirefoxProfile(): Is it possible to use a profile without making a copy of it? (1 answer) Closed 6 days ago . I couldn't find any relevant answers and my question is pretty straight forward. The context isn't really relevant. It is very important for me that Selenium uses my normally installed browser (Chrome or Firefox), when doing coded things.

Protractor - Check if a radio-button is checked or not

点点圈 提交于 2021-02-11 04:49:06
问题 So I have this problem where I run a protractor/selenium test and sometimes a radio-button is already checked during the test and sometimes its not. etc: <div id="TRUCK" class="radio-item checked" data-gtm="truck"> or <div id="TRUCK" class="radio-item" data-gtm="deliveryOpt-truck"> where you can see the class sometimes have the "checked" init and sometimes not. What I am trying to do solve is that I want to make a function that clicks IF the radio-button is not checked and if its already

Python+Appium学习篇之WebView处理

…衆ロ難τιáo~ 提交于 2021-02-11 02:26:03
1.认识WebView 实例说明: 当你打开百度阅读APP→VIP全站去广告→用自带的 UI Automator去定位里面的元素,如图: 不管你去定位 '规则详情' '开通'等等,都会定位不到,只能显示一个整体页面,这个就是WebView Note: ① 可以理解与selenium里的iframe类似 ②在右边定位里有明确的表示是 WebView ③点击一个链接后,有进度条加载后页面一般都是Webview. 也就是说,是一个H5页面了 ④UI Automator 不能定位到里面的元素 处理方法1: ①执行 print(driver.contexts) 获取所有的上下文 ②在切换到他的webview里面去(类似selenium里的切换窗口) ③获取到他的webview源码,在其他浏览器打开,获取他的xpath路径,或者其他定位方法 # coding:utf-8 from appium import webdriver import time u ''' 智行火车票,webview页面定位 ''' desired_caps = { ' platformName ' : ' Android ' , ' deviceName ' : ' 9a762346 ' , ' platformVersion ' : ' 6.0.1 ' , ' noReset ' : True, '