Find Element Missing in Source Code

86 views
Skip to first unread message

Eric Vandiver

unread,
Jul 28, 2022, 3:02:56 AM7/28/22
to Selenium Users
I am trying to complete a form using browser automation through Splinter.   Neither the element nor the form may be found in View Page Source.  However, I can view the element and form when I click Inspect (see pic).  The highlighted 'input id' is the element I would like to complete.  I have tried various find element techniques as described at https://splinter.readthedocs.io/en/latest/finding.html.  For instance, when I run:

browser.find_by_id('optionChainSymbol').first.fill('AAPL')

I receive an error message stating:

ElementDoesNotExist: no elements could be found with id "optionChainSymbol"

How do I use browser automation to enter information into this form?

pageSource.png

ebubekir bastama

unread,
Jul 28, 2022, 3:39:49 AM7/28/22
to seleniu...@googlegroups.com
what is the website address
this xpath you can use
"//*[@class='lighter']"
example code c#
drv.FindElement(By.XPath("//*[@class='lighter']")).SendKeys("example data");

but If there is an iframe on the page, it is necessary to use a different method.

Eric Vandiver <ericvand...@gmail.com>, 28 Tem 2022 Per, 10:02 tarihinde şunu yazdı:
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/b920e263-2565-4d94-945f-4fd36de3a09dn%40googlegroups.com.

Eric Vandiver

unread,
Aug 7, 2022, 6:58:16 PM8/7/22
to Selenium Users
Thank you for replying.

The site with which I am using browser automation requires login credentials from https://www.tdameritrade.com/.   I have successfully used browser automation on this site until I reached the page in question.

I used this code in python on an element after logging into the site:
browser.find_element(By.XPATH, "//*[@class='lighter']").send_keys('AAPL')

I received this error:
NoSuchElementException: Message: Unable to locate element: //*[@class='lighter'] Stacktrace: WebDriverError@chrome://remote/content/shared/webdriver/Errors.jsm:188:5 NoSuchElementError@chrome://remote/content/shared/webdriver/Errors.jsm:400:5 

There appears to be an iframe on the page.  When I view page source, the following iframes are on the page:
<iframe id='noscript-frame' src="/grid/p/javascriptDisabled"></iframe>
<iframe id="vceIframe" name="vceIframe" src="/amer/html/blank.html" width="100%" height="100%" frameborder="0"></iframe>
<iframe id="agentIframe" name="agentIframe" src="/amer/html/blank.html" width="0" height="0" style="display:none;"></iframe>
<iframe data-dojo-attach-point="frameNode" id="snapticket" name="snapticket" frameborder="0" width="948px" height="124px" scrolling="no" src="/amer/html/blank.html"></iframe>

What method do I use for browser automation when there is an iframe on the page?

Dør Blayzer

unread,
Aug 22, 2022, 6:00:38 PM8/22/22
to Selenium Users
hi,
in case you have an ID for the frame you can do something like the below:

//Using the ID
driver.SwitchTo().Frame("buttonframe");

//Or using the name instead
driver.SwitchTo().Frame("myframe");

//Now we can click the button
driver.FindElement(By.TagName("button")).Click();
  
see more here:
https://www.selenium.dev/documentation/webdriver/browser/frames/


Reply all
Reply to author
Forward
0 new messages