Click on path under svg element | Selenium Python Forum
Sambhav Puri Posted on 09/04/2021


I want to click on an element path under svg. I am using the xpath //*[@id="buttonname"]/span[1]/svg/path to click on the element.

However it is not able to interact with it.


Following is the html. How can I interact with the element?


	<div id="root">
				<header class="headerclass">
					<div class="firstdivclass">
						<button class="buttonclass" tabindex="0" type="button" id="buttonname" aria-label="menu">
							<span class="firstspanclass">
								<svg class="svgclass" focusable="false" viewBox="0 0 24 24" aria-hidden="true">
									<path d="path"></path>
							<span class="secondspanclass"></span>
						<h5 class="h5class">Name</h5>
			<div class="seconddivclass"></div>
			<div class="thirddivclass">
				<div class="fourthdivclass">
					<h6 class="h6class">Welcome</h6>
	<script src="jspath"></script>

Jaspreet Replied on 12/04/2021


What is the exception coming?

Sambhav Puri Replied on 12/04/2021

It was that the element //*[@id="buttonname"]/span[1]/svg/path is not found

Sambhav Puri Replied on 12/04/2021

I found the solution. I had to modify the xpath to: