I want to find elements inside an iframe tag. However, in the HTML source there isn't any iframe tag. If I inspect element there is, though. How to solve this using Selenium library in Python 2.7?
HTML source
Screenshot
Inspect element
Screenshot
If it's dynamically generated, it could explain why it's not found in the Selenium version of the DOM. You can still get it by using JavaScript in your code.
driver.execute_script("return document.getElementsByClassName('card-fields-iframe')")
Related
I'm kinda new to coding and would appreciate any help - i can't get text with selenium from DOM which is generated by JS. I will attach the screen below. I'm trying to get the text like this:
driver.findElement(By.xpath("//div/a[#class='item']")).getText()
But i'm getting such error and couldn't find any answers on stackoverflow and anywhere else:
Exception in thread "main" org.openqa.selenium.StaleElementReferenceException: stale element reference: element is not attached to the page document
Screenshot
I'm trying to click on href javascript link with Selenium in Python.
The HTML looks like this:
HTML Example
and I want to click on javascript:goType(1).
this is what I tried to do:
advance_search = browser.find_element_by_xpath("//a[#href='javascript:goType(1)']")
advance_search.click()
but it failed with: selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//a"}
Moreover, when I trying to print all "a" tags it prints an empty lists (Maybe this cause the error). Is There a chance that it isn't possible?
I searched for similars answers but they didn't helped. Plese help me :).
I think I realized something: When I did browser.find_elements_by_tag_name("body") it didn't found anything, but when I
tried with "head" it did found, and then I discovered that there is a 'page source' and a 'frame source', and my code works only on the page source and not on the frame source.
It doesn't finds anything because all my code is in the frame source.
How could I run selenium on the frame source?
I'm using Firebug's Inspector to view source code. My code has been modified by JavaScript. I'd like to save the rendered code to a file, so that I can more easily compare it to the unmodified source. I'm having no luck with copy/paste. When I attempt to select the code, the contents of the inspector changes. I'm running OSX.
How can I save the rendered source code?
Hmmm.. Would expanding the HTML element in FB and then hitting CMD+A, CMD+C not help? What about using JS to copy the inner HTML of the top-most parent?
I am trying to locate an element(tabs) on a webpage using its xpath but instead of locating it, the code is selecting the tab just above it. Xpath used is absolute. Please suggest on this, anyone.
Following is the code snippet:
WebElement table=(new WebDriverWait(driver,200)).until(ExpectedConditions.presenceOfElementLocated(By.xpath("//tagname[#title='value']")));
Thread.sleep(500);
table.click();
tabs in this context,basically are webpage titles arranged one below the other in form of tabs,one can access these webpages on clicking on these tabs.
Is it possible to create dynamically addressed LIKE button in XUL ?
Need to place it on XUL OVERLAY toolbar.
My idea is about IFRAME addressing like_button.html in chrome:// and changing src param inside. But there is javascript interaction with button, which can be problem, isn't it?
Thanks
as far as I know there won't be any problem in changing the parameters inside or outside using JavaScript and XUL. Using DOM you can manipulate anything & you can create any elements dynamically in XUL JavaScript.
https://developer.mozilla.org/en/Dynamically_modifying_XUL-based_user_interface
https://developer.mozilla.org/en/XUL_Tutorial/Document_Object_Model
https://developer.mozilla.org/en/XUL_Tutorial/Modifying_a_XUL_Interface
http://mb.eschew.org/15
These links will be more helpful for you to go on!!!!