Timeline for answer to Python Selenium error: NoSuchElementException by Andersson
Current License: CC BY-SA 3.0
Post Revisions
19 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jul 12, 2017 at 19:10 | history | edited | Andersson | CC BY-SA 3.0 |
edited body
|
| Jul 12, 2017 at 19:10 | comment | added | Andersson |
@MQ1217, trumba.spud.1.iframe is iframe ID. If you need general selector you can try wait(driver, 10).until(EC.frame_to_be_available_and_switch_to_it(driver.find_element_by_tag_name('iframe'))), but this will allow you to switch to first iframe on the page. If target element located inside of another iframe, you should use more specific selector
|
|
| Jul 12, 2017 at 18:58 | vote | accept | MQ1217 | ||
| Jul 12, 2017 at 18:58 | comment | added | MQ1217 | @IamBatman Also, thank you so much for your help :). Appreciate it. | |
| Jul 12, 2017 at 18:57 | comment | added | MQ1217 | @Andersson awesome! It worked and downloaded the .ics file for me. Thank you so much for your help. Last question: because 'trumba.spud.1.iframe' I'm assuming is the specific iframe name containing the .ics for this site, is there a way to generalize this to work for any webpage that has an '.ics' href inside an iframe? | |
| Jul 12, 2017 at 18:49 | history | edited | Andersson | CC BY-SA 3.0 |
added 279 characters in body
|
| Jul 12, 2017 at 18:45 | comment | added | Andersson | Oh, I didn't notice the link to target page :) Let me check the page source | |
| Jul 12, 2017 at 18:43 | comment | added | IamBatman | Wow, totally missed that iFrame. @Andersson if you go straight to his/her driver.get in his/her first post you can get to the page in question. | |
| Jul 12, 2017 at 18:42 | comment | added | IamBatman | True, but I did confirm that "services.ics" shows up twice in the page when searching elements via the dev console. It also has two "titles" of the same name, but as you stated if you reference the "a" tag in the xpath it shows only one element with that title. | |
| Jul 12, 2017 at 18:41 | comment | added | Andersson |
@MQ1217, can you share HTML of iframe element?
|
|
| Jul 12, 2017 at 18:40 | comment | added | MQ1217 | @Andersson Yes, there appears to be <iframe src="javascript:... in one of the ancestors. Basically the href containing a '.ics' is all I am trying to return. Unfortunately this process appears to be a lot more complicated than for pages just generated with html/css ;) | |
| Jul 12, 2017 at 18:38 | comment | added | Andersson |
@IamBatman, No. If there are more than one webelement matched by XPath, then we could get ElementNotVisibleException or handle wrong element, but not get NoSuchElementException or TimeoutException in case explicitWait was used...
|
|
| Jul 12, 2017 at 18:25 | comment | added | IamBatman | It could also mean there are more than one element that has the "services.ics" href or the "title" is used more than once via the a tag. | |
| Jul 12, 2017 at 18:09 | comment | added | Andersson |
This might mean that link located inside an iframe. Can you check if there is an <iframe> element among link ancestors?
|
|
| Jul 12, 2017 at 18:07 | comment | added | MQ1217 | Received a TimeoutException: Message: by applying the ExplicitWait. Would this mean the link is not generated dynamically? | |
| Jul 12, 2017 at 17:17 | history | edited | Andersson | CC BY-SA 3.0 |
added 511 characters in body
|
| Jul 12, 2017 at 17:09 | comment | added | MQ1217 | Hi @Andersson, thanks for your very detailed resonse. However, when I try running this code driver.find_element_by_xpath('//a[contains(@href, "services.ics")]') I receive NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"a[href$=".ics"]"} (Session info: chrome=59.0.3071.115) | |
| Jul 12, 2017 at 16:58 | history | edited | Andersson | CC BY-SA 3.0 |
added 279 characters in body
|
| Jul 12, 2017 at 16:52 | history | answered | Andersson | CC BY-SA 3.0 |