webdriverwait

Selenium Web driver wait for long time

落花浮王杯 提交于 2019-12-03 16:27:17
Can I wait with Selenium Web Driver for a long time period? Even though I can set implicitlywait command like below, it doesn't wait the time that I've given. driver.manage().timeouts().implicitlyWait(5, TimeUnit.MINUTES); Is there anything wrong here? In my case, I need to execute one test case and wait for 4 minutes and then execute the next test case. I use Java here. Considering you need to wait for a particular element i'd do something in the lines of a ExplicitWait like below. WebDriverWait wait = new WebDriverWait(driver, 300); // The int here is the maximum time in seconds the element

How to extract the title and href attributes from the questions on reddit.com search page using Selenium Python

偶尔善良 提交于 2019-12-02 20:53:16
问题 I want to scrape the link and title of all the questions on the page https://www.reddit.com/search?q=Expiration&type=link&sort=new. An element has the following structure: <a data-click-id="body" class="SQnoC3ObvgnGjWt90zD9Z" href="/r/excel/comments/ayiahc/calculating_expiration_dates_previous_solution_no/"> <h2 class="s1okktje-0 cDxKta"> <span style="font-weight:normal">Calculating Expiration Dates - Previous Solution No Longer Works</span> </h2> </a> I use questions = driver.find_elements

How do I get Selenium to login to the website Costco.com

一笑奈何 提交于 2019-12-02 20:06:24
问题 Picture of the screen it stays on forever: I am having trouble getting Selenium to login to Costco.com. It basically freezes at the login screen and won't proceed to the next screen. from selenium import webdriver; from selenium.webdriver.support.ui import Select; from selenium.webdriver.common.keys import Keys; from selenium.webdriver.common.by import By; import time; browser = webdriver.Chrome() browser.get('https://www.costcobusinessdelivery.com/LogonForm?URL=%2f') email = browser.find

How to print the href attributes using beautifulsoup while automating through selenium?

[亡魂溺海] 提交于 2019-12-02 19:03:10
问题 Blue element's href value is what i want to access from this HTML I tried few ways to print the link but didn't work. My code below:- discover_page = BeautifulSoup(r.text, 'html.parser') finding_accounts = discover_page.find_all("a", class_="author track") print(len(finding_accounts)) finding_accounts = discover_page.find_all('a[class="author track"]') print(len(finding_accounts)) accounts = discover_page.select('a', {'class': 'author track'})['href'] print(len(accounts)) Output:- 0 0

ElementNotInteractableException: Message: Element could not be scrolled into view while trying to click an element using Selenium and Python

最后都变了- 提交于 2019-12-02 18:32:45
问题 I have this code: driver.switch_to.window(window_after) try: myElem = WebDriverWait(driver, delay).until(EC.presence_of_element_located((By.NAME, '_eventId_confirmed'))) print ("Page 2 is ready!") except TimeoutException: print ("Loading took too much time!") btn = driver.find_element_by_name('_eventId_confirmed') btn.click() as you can see I first switch window and then check for an element, get that element (a button) and finally try to click on said button. This works maybe 2 out of 3

Scrape website with dynamic mouseover event

不问归期 提交于 2019-12-02 17:53:22
问题 I am trying to scrape data which is generated dynamically from mouseover events. I want to capture the information from the Hash Rate Distribution chart from https://slushpool.com/stats/?c=btc which is generated when you scroll over each circle. The code below gets the html data from the website, and returns the table which is filled once the mouse passes over a circle. However, I have not been able to figure out how to trigger the mouseover event for each circle to fill the table. from lxml

Windows Handling Closes the whole browser if i try to close the current window in python

人盡茶涼 提交于 2019-12-02 15:43:01
问题 Am currently using windows handling for opening the map direction in the new window and after it opens i will be closing the child window, which is opened and do the remaming work in the code.But it is closing the whole browser, while debugging it is working correctly , but while running the code, am Getting the error as, Error - selenium.common.exceptions.NoSuchWindowException: Message: no such window: target window already closed Down i have attached the code, ##Clicking on The Map Image

Unable to locate element and TimeoutException when WebDriverWait is used

北慕城南 提交于 2019-12-02 13:03:31
I'm trying to automate the clicking of the "SHOW MORE" button at the bottom of the page to get all the reviews there is. However, I'm having some problems locating it and would really appreciate it if you could help me out. I have tried a couple of methods but I am not sure why none of them work. 1) Method 1: CSS Selector driver.find_element_by_css_selector("U26fgb.O0WRkf.oG5Srb.C0oVfc.n9lfJ.M9Bg4d") leads to: NoSuchElementException: Message: no such element: Unable to locate element 2) Method 2 : XPath Helper (an extension on Chrome) driver.find_element_by_xpath("/html/body[@id='yDmH0d']/div[

Unable to locate the child iframe element which is within the parent iframe through Selenium in Java

萝らか妹 提交于 2019-12-02 10:09:45
问题 So far, this is what I have: I've switched the frame to its parent frame then to the the frame I am unable to locate: By frame = By.xpath("//iframe[@class='GenCss_style-Model']"); driver.switchTo().frame(driver.findElement(By.name("documentflowdesk"))); driver.switchTo().frame(driver.findElement(frame)); Since 'frame' element is not found, I get this error: org.openqa.selenium.NoSuchElementException: Unable to locate element HTML: <iframe src="about:blank" name="documentflowdesk" class="gwt

sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) using findElement(By.className()) through Selenium and Java

匆匆过客 提交于 2019-12-02 09:49:50
When I execute the following code: driver.findElement(By.className("qview-product-name")).click(); I get the following error Session ID: d5df6f837164b1738991e8dc09027fe0 *** Element info: {Using=class name, value=qview-product-name} at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException