Question selenium automatic python bot

Leo_nard

Prominent
Jan 6, 2020
5
0
510
I'm noob with selenium, i need help to click a button between button tags. I tried to use find_element_by_tag_name, but it does not work cause there are other button tags scattered around before and if i try by_class_name or by_xpath it tells me there is nothing that can match and return a "exception". Please anyone could help me? this is code:

<div class="footer--1L-3T">
<div class="buttonContainer--33jjD" data-role="button-container">
<div class="buttonContainerItem--286mU restrictedMinWidth--1yzrO" data-role="button-container-item">
<button class="button--3h5xe buttonSizeDefault--3mQ1i buttonStateDefault--3rSF6
buttonLabelPositionInside--2JRkN buttonIconPositionLeft--2FL2w buttonThemePopup--38gEr
buttonModeDesktop--i3Cpv buttonFitWidth--2WSgF" data-role="button" tabindex="-1">
<span data-role="button-bordered" class="bordered--3kSwE roundingBoth--177dl">
<span data-role="button-label" class="label--2kPAA labelCapitalized--3pF45">Exit</span>
</span>
</button>
</div>
<div class="buttonContainerItem--286mU restrictedMinWidth--1yzrO" data-role="button-container-item">
<button class="button--3h5xe buttonSizeDefault--3mQ1i buttonStateDefault--3rSF6
buttonLabelPositionInside--2JRkN buttonIconPositionLeft--2FL2w buttonThemePopup--38gEr
buttonModeDesktop--i3Cpv buttonFitWidth--2WSgF" data-role="button" tabindex="-1">
<span data-role="button-bordered" class="bordered--3kSwE roundingBoth--177dl">
<span data-role="button-label" class="label--2kPAA labelCapitalized--3pF45">OK</span>
</span>
</button>
</div>
</div>

i have to click "ok" button which is the second.
ps: sorry for the format of the code but still i didn't menaged to use it this well
 

Leo_nard

Prominent
Jan 6, 2020
5
0
510
writing your own bot?
how did you search the xpath?
yes exact.
i went on the respective element using shift+ctrl+c and then copy->copy xpath, and i got something like that:
//*[@id="root"]/div/div/div/div[10]/div/div/div/div[3]/div/div[2]/button
which is the xpath's copy of second button tag, but it tells me there is nothing that match
 

TRENDING THREADS