1

I am automating a process using Selenium and python. Right now, I am trying to click on a button in a webpage (sorry I cannot share the link, since it requires credential to login), but there is no way my code can find this button element. I have tried every selector (by id, css selector, xpath, etc.) and done a lot of googling, but no success.

Here is the source content from the web page:

<button onclick="javascript: switchTabs('public');" aria-selected="false" itemcount="-1" type="button" title="Public Reports" dontactassubmit="false" id="public" aria-label="" class="col-xs-12 text-left list-group-item tabbing_class active"> Public Reports </button>

I also added a sleep command before this to make sure the page is fully loaded, but it does not work.

Can anyone help how to select this onclick button? Please let me know if you need more info.

Edit: you can take a look at this picture to get more insight (https://ibb.co/cYXWkL0). The yellow arrow indicates the button I want to click on.

1 Answer 1

1

The element you trying to click is inside an iframe. So, you need to switch driver into the iframe content before accessing elements inside it.
I can't give you a specific code solution since you didn't share a link to that page, even not all that HTML block. You can see solutions for similar questions here or enter link description here. More results can be found with google search

Sign up to request clarification or add additional context in comments.

4 Comments

Yes, the iframe thing did the trick. Thanks a lot.
You are always welcome my friend! Next time, if possible, share a link to the page or at least the entire XML as a text, not a picture.
I faced another issue and I want to post it in as a separate question, but I don't know how to copy the entire XML as a text.
Paste it as a code: line with 3 ` signs before and line with 3 ` signs after. It is not ' but ```.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.