I’ve tried several ways to locate this element using driver.find_element(By.*)
but have had no success. Can anyone provide guidance?
HTML Elements:
html elements
<button class="MuiButtonBase-root MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeMedium MuiButton-containedSizeMedium MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeMedium MuiButton-containedSizeMedium css-10qa0nr" tabindex="0" type="button">
Add Lead
<span class="MuiTouchRipple-root css-w0pj6f"></span>
</button>
Also, why is the class name so long and should I copy the whole class name or only part of it if I want to locate the element using the class name?
2
Answers
Found the solution:
Need to switch the driver to iframe first before locating the element.
When inspecting the element, need to scroll up to see if the element is inside the iframe or not
inspect element selenium script
You can use XPath locator and it’s
contains
method like below: