So I'm trying to scrap a a salesforce page and I have structure like this
<html>
<div class="windowViewMode-normal oneContent active lafPageHost" data-aura-rendered-by="1235:0"
data-aura-class="lafPageHost">
<!--render facet: 1264:0-->
<div class="oneAlohaPage" data-aura-rendered-by="1266:0" data-aura-class="oneAlohaPage">
<force-aloha-page data-data-rendering-service-uid="396" data-aura-rendered-by="1269:0"
force-alohapage_alohapage-host="">
<div force-alohapage_alohapage="" class="iframe-parent slds-template_iframe slds-card">
<iframe force-alohapage_alohapage="" height="100%" width="100%" scrolling="yes" allowtransparency="true"
name="vfFrameId_1687293452916" title="Time Entry" allowfullscreen="true" lang="en-US"
allow="geolocation *; microphone *; camera *; display-capture *" tabindex="0" spellcheck="false"
src="./Time Entry _ Salesforce_files/saved_resource.html"></iframe>
</div>
</force-aloha-page>
</div>
</div>
</html>
and the HTML goes on, I know that because I have the iframe I have to switch to it, but when I try
iframe = driver.find_element(By.TAG_NAME, 'iframe')
I get an NoSuchElementException
saying it cannot find it, I saw a #shadow-root (open)
in a tag inside the <iframe>
not sure if that could be the issue
EDIT
I found a way to get the iframe, I got the div just before it and then the iframe inside of it
iframeParent=driver.find_element(By.XPATH,'//[@id="brandBand_2"]/div/div/div[2]/div/force-aloha-page/div')
iframe = iframeParent.find_element(By.TAG_NAME, 'iframe')
but I don't know why it worked