0

I just started to learn how to code in Python 2 months ago through a university course. I am working on my first personal project where I want to navigate through a website and execute some actions in it. I am currently using Selenium and found its find_element commands easy to use and have been able to log into my account on the website without a problem. However, once logged in, the find_element commands stopped working, because the element I am trying to find in order to click it, does not have an id or name, and the Class name and Xpath commands do not seem to respond either. I have been stuck for the past 24 hours looking into why these are not working. I have been able to find out that the element is inside an iframe (which I don't quite understand much yet) and it is also inside of a slick-slide. Below, I will share the element:

<div class="item ng-scope slick-slide" data-index="$index+1" ng-repeat="date in datesObj" ng-click="setDate($index+1, date)" style="width: 88px;" tabindex="-1" role="option" aria-describedby="slick-slide03" data-slick-index="3" aria-hidden="true"> <div class="day ng-binding">Fri</div> <div class="date ng-binding">Dec 9</div> </div>

https://www.capefearcountryclub.net/CMSModules/CHO/TeeTimes/PublicTeeTimes.aspx#!/

Replica website

My Website

Would really appreciate help with this.

  • if the element is inside of an iframe you have to switch to that iframe in order to click on elements inside. Please, check this answer https://stackoverflow.com/a/48729644/11059912 – Robson Sampaio Dec 07 '21 at 20:58
  • Thank Robson. I had already switched to that ifram (I forgot to mention that). But once I have switched to the iframe, am I supposed to use the regular find_element functions I was originally using?? Appreciate the help – Ivan Humbert Dec 07 '21 at 21:44
  • Yes, if you switched to the iframe it is supposed to work. But there are other things do considere. Please Ivan, edit you question and post you code and any relevant log error. If you could also provide the link to the webpage it would help the community to understand the issue. Thanks!! – Robson Sampaio Dec 07 '21 at 22:40
  • Ok, it is not working after I switch to the iframe. I am going to post the link to a website that uses the same code and a screenshot of the website with the inspect window open to the element I want to click on, in this example it is "Thu Dec 9". The HTML code is exactly the same as the one on the website I am working on, except that the line before the first, is the one that established the iframe. I will also attach a screenshot of the code of the actual website I am working on, so you can see it. Thanks a lot, Robson! – Ivan Humbert Dec 07 '21 at 23:05

0 Answers0