webdriverwait

How to extract the text from the search results of duckduckgo using Selenium Python

﹥>﹥吖頭↗ 提交于 2021-02-05 08:09:12
问题 I am trying to get the link descriptions of duckduck of search results using the following: results=browser.find_elements_by_xpath("//div[@id='links']/div/div/div[2]") description=[] for result in results: description.append(result.text) I am getting the error 'list' object has no attribute 'text'. I was able to use a similar method to get the search result titles, but for some reason I am unable to extract the text from this particular xpath. 回答1: To extract the link descriptions of the

Automate Ember.js application using Selenium when object properties are changed at run-time

本秂侑毒 提交于 2021-02-05 07:57:06
问题 I am trying to automate an Ember.js application using Selenium+TestNg. The drop-down in the application has only one object property id. However every time i refresh the Page id gets change and there is not pattern. Eg: First time i open a page id=ember1398 and when i refresh the page same object id changes to ember1097. I would be greatful if some one can guide me in overcoming this challenge. I am open to change tool/framework if necessary. 回答1: This is a known issue with Ember. We work

Cannot cast from List<Functions.Function1<Object,String>> to List<String> creating a list from list of WebElements using Selenium and stream() Java8

狂风中的少年 提交于 2021-02-05 07:49:51
问题 I'm trying to read an HTML table and get all the values into a 2d list using selenium. I'm using streamable to create a List inside another map() method. But I get Cannot cast from List<Functions.Function1<Object,String>> to List<String> error at nested collect method's line HTML: +--------+-------+ | r1 v1 | r1 v2 | +--------+-------+ | r2 v1 | r2 v2 | +--------+-------+ <html> <body> <table> <tbody> <tr> <td> <div> <span>r1 v1</span> </div> </td> <td> <div> <span>r1 v2</span> </div> </td> <

Cannot cast from List<Functions.Function1<Object,String>> to List<String> creating a list from list of WebElements using Selenium and stream() Java8

巧了我就是萌 提交于 2021-02-05 07:49:08
问题 I'm trying to read an HTML table and get all the values into a 2d list using selenium. I'm using streamable to create a List inside another map() method. But I get Cannot cast from List<Functions.Function1<Object,String>> to List<String> error at nested collect method's line HTML: +--------+-------+ | r1 v1 | r1 v2 | +--------+-------+ | r2 v1 | r2 v2 | +--------+-------+ <html> <body> <table> <tbody> <tr> <td> <div> <span>r1 v1</span> </div> </td> <td> <div> <span>r1 v2</span> </div> </td> <

ElementNotInteractableException: Message: Element could not be scrolled into view using GeckoDriver Firefox with Selenium WebDriver

偶尔善良 提交于 2021-02-05 07:45:06
问题 How can I fix the error: selenium.common.exceptions.ElementNotInteractableException: Message: Element <> could not be scrolled into view error when working with Firefox via Selenium? None of the tips from the site did not help me. I tried all the solutions I could find, including through WebDriverWait and JS. One of the solutions gave: selenium.common.exceptions.MoveTargetOutOfBoundsException: Message: (568, 1215) is out of bounds of viewport width (1283) and height (699) I tried resizing the

How to extract all href from a class in Python Selenium?

自作多情 提交于 2021-02-04 20:48:09
问题 I am trying to extract people's href from the URL https://www.dx3canada.com/agenda/speakers. I tried: elems = driver.find_elements_by_css_selector('.display-flex card vancouver') href_output = [] for ele in elems: href_output.append(ele.get_attribute("href")) print(href_output) But the output list returns nothing... The expected href shown as the image below and I hope the outputs as a list of hrefs: I really appreciate the help! 回答1: To extract the people's href attribute from the URL https:

How to switch between iframes using Selenium and Python?

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-04 08:28:49
问题 I'm trying to make a script to checkout on a Shopify site and I was able to find the iframe for the card number, but was not able to find the iframe for the name on the card (2nd iframe). Is there any way to enter in a value for that iframe? driver.switch_to.frame(driver.find_element_by_tag_name("iframe")) driver.find_element_by_xpath('//input[@autocomplete="cc-number"]').send_keys("1234") driver.find_element_by_xpath('//div[@data-card-field-placeholder="Name on card"]').click() driver.switch

Selenium won't type to textarea and raises ElementNotInteractableException

大憨熊 提交于 2021-02-04 08:28:27
问题 This is the HTML code in question: <textarea rows="1" cols="1" name="text" class=""></textarea> This is my code: msgElem = driver.find_element_by_css_selector("textarea[name='text']") driver.execute_script("arguments[0].click();", msgElem) driver.execute_script("arguments[0].value = 'Whats up mate, how you doin';", msgElem) msgElem.submit() The code executes and nothing happens. I assume it selects the textarea but doesn't type nothing into it? or nothing happens at all. It also finds the

How to solve a StaleElementReferenceException: Message: stale element reference: element is not attached error using Selenium Ubuntu EC2 using Python

余生颓废 提交于 2021-02-04 08:27:30
问题 I am trying to extract all data of column "Nb B" in this page : https://www.coteur.com/cotes-foot.php When I run my code from a Ubuntu PC It works perfectly but when I tried with EC2 Ubuntu It does not give me the good return. Here is my server : ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-20200611 (ami-0a63f96e85105c6d3) Here is the python script : #!/usr/bin/python3 # -*- coding: utf­-8 ­-*- from selenium import webdriver from selenium.webdriver.chrome.options import Options

How to click a link within youtube comment using python selenium

六眼飞鱼酱① 提交于 2021-02-04 08:26:31
问题 I'm new to selenium python, I'm trying to click a link in the youtube comment but I don't know what element to use? Can someone help me? thanks . example : <a class="yt-simple-endpoint style-scope yt-formatted-string" spellcheck="false" href="/redirect?event=comments&redir_token=ttzJJRuKzz6sJPh8qdMnWStc-958MTU0NjE1NDU4M0AxNTQ2MDY4MTgz&stzid=Ugw6ip_QkzwyJPIq3bp4AaABAg&q=https%3A%2F%2Fjulissars.itworks.com%2F" rel="nofollow">https://julissars.itworks.com</a> link 回答1: To click on the desired