webdriverwait

StaleElementReferenceException: element is not attached to the page document while selecting the options from multiple Dropdowns using Selenium Python

耗尽温柔 提交于 2020-06-23 13:29:47
问题 Code trial: #coding=utf-8 from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import Select, WebDriverWait from selenium.webdriver.support import expected_conditions as EC import time import pandas as pd # Below is to crawl data from a webpage with two different dropdown try: driver = webdriver.Chrome('./chromedriver') driver.get('https://price.joinsland.joins.com/theme/index_theme.asp

StaleElementReferenceException: element is not attached to the page document while selecting the options from multiple Dropdowns using Selenium Python

痞子三分冷 提交于 2020-06-23 13:28:45
问题 Code trial: #coding=utf-8 from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import Select, WebDriverWait from selenium.webdriver.support import expected_conditions as EC import time import pandas as pd # Below is to crawl data from a webpage with two different dropdown try: driver = webdriver.Chrome('./chromedriver') driver.get('https://price.joinsland.joins.com/theme/index_theme.asp

How to find an element with respect to the user input using Selenium and Python?

做~自己de王妃 提交于 2020-06-23 12:54:49
问题 The following is the HTML structure: <div class='list'> <div> <p class='code'>12345</p> <p class='name'>abc</p> </div> <div> <p class='code'>23456</p> <p class='name'>bcd</p> </div> </div> And there is a config.py for user input. If the user input 23456 to config.code, how can the selenium python select the second object? I am using find_by_css_selector() to locate and select the object, but it can only select the first object, which is Code='12345' . I tried to use find_by_link_text() , but

How to find an element with respect to the user input using Selenium and Python?

送分小仙女□ 提交于 2020-06-23 12:51:06
问题 The following is the HTML structure: <div class='list'> <div> <p class='code'>12345</p> <p class='name'>abc</p> </div> <div> <p class='code'>23456</p> <p class='name'>bcd</p> </div> </div> And there is a config.py for user input. If the user input 23456 to config.code, how can the selenium python select the second object? I am using find_by_css_selector() to locate and select the object, but it can only select the first object, which is Code='12345' . I tried to use find_by_link_text() , but

How to retrieve partial text from a text node using Selenium and Python

别来无恙 提交于 2020-06-23 12:21:11
问题 I want to get only " text ... " not using .split() or index slicing HTML: <a class="call_recipe" href="/recipes/2913"> " text ... " <strong> something~ </strong> </a> HTML Snapshot: 回答1: To print text ... you have to induce WebDriverWait for the visibility_of_element_located() and you can use either of the following Locator Strategies: Using CSS_SELECTOR and childNodes : print(driver.execute_script('return arguments[0].firstChild.textContent;', WebDriverWait(driver, 20).until(EC.visibility_of

How to retrieve partial text from a text node using Selenium and Python

霸气de小男生 提交于 2020-06-23 12:19:59
问题 I want to get only " text ... " not using .split() or index slicing HTML: <a class="call_recipe" href="/recipes/2913"> " text ... " <strong> something~ </strong> </a> HTML Snapshot: 回答1: To print text ... you have to induce WebDriverWait for the visibility_of_element_located() and you can use either of the following Locator Strategies: Using CSS_SELECTOR and childNodes : print(driver.execute_script('return arguments[0].firstChild.textContent;', WebDriverWait(driver, 20).until(EC.visibility_of

How to locate the username and password field within Instagram login page using Chromedriver and Selenium Python

霸气de小男生 提交于 2020-06-23 11:02:01
问题 Here's inspected source code input aria-label="Phone number, username, or email" aria-required="true" autocapitalize="off" autocorrect="off" maxlength="75" name="username" type="text" class="_2hvTZ pexuQ zyHYP" value="" I have tried this code run driver = webdriver.Chrome() driver.get('https://www.instagram.com/') driver.find_element_by_xpath("//input[@name=\"username\"]").send_keys(username) driver.find_element_by_xpath("//input[@name=\"password\"]").send_keys(pw) driver.find_element_by

How to locate the username and password field within Instagram login page using Chromedriver and Selenium Python

ⅰ亾dé卋堺 提交于 2020-06-23 11:01:53
问题 Here's inspected source code input aria-label="Phone number, username, or email" aria-required="true" autocapitalize="off" autocorrect="off" maxlength="75" name="username" type="text" class="_2hvTZ pexuQ zyHYP" value="" I have tried this code run driver = webdriver.Chrome() driver.get('https://www.instagram.com/') driver.find_element_by_xpath("//input[@name=\"username\"]").send_keys(username) driver.find_element_by_xpath("//input[@name=\"password\"]").send_keys(pw) driver.find_element_by

How to locate the username and password field within Instagram login page using Chromedriver and Selenium Python

て烟熏妆下的殇ゞ 提交于 2020-06-23 10:59:28
问题 Here's inspected source code input aria-label="Phone number, username, or email" aria-required="true" autocapitalize="off" autocorrect="off" maxlength="75" name="username" type="text" class="_2hvTZ pexuQ zyHYP" value="" I have tried this code run driver = webdriver.Chrome() driver.get('https://www.instagram.com/') driver.find_element_by_xpath("//input[@name=\"username\"]").send_keys(username) driver.find_element_by_xpath("//input[@name=\"password\"]").send_keys(pw) driver.find_element_by

How to clear text field before sending keys selenium c#

依然范特西╮ 提交于 2020-06-23 08:47:27
问题 I'm writing a simple selenium test which sends an incorrect string of letters then submits and returns and error. I want to then send a string of letter but this time with the correct string so it is accepted. The issue i'm facing in my test is as the first set of string is already in the text field, so when i go to the submit the second one it adds it on to the first string that has already been submitted. So what i essentially need to do is send the first string of letters then need to