0

I'm trying to click on the web using VBA+selenium+Chrome
This is my code

dim y as webelement

Set y = driver.FindElementByXPath("//span[@class='source']")     ' not working
Set y = driver.FindElementByXPath("//div[@class='material-icons md-20 icon' and text()='code']") ' not working
x = driver.ExecuteScript("arguments[0].click();", y) ' not working

driver.FindElementByXPath("/html/body/div[1]/div/div[2]/div[1]/div[1]/div/div/div/div/div[3]/form/div/div/div[1]/div[4]/div/div[1]/div/div[2]/div/div/div/div[2]/div[1]/div[2]/div[1]/div[13]/div/span").click   ' not working

This is HTML
enter image description here



Chrome version 96.0.4664.110. ChromeDriver 96.0.4664.45
I use the default profile
If I use profile 1, the code works
can anyone help me ?

1
  • what is the difference between the two profiles? Are you sure you are not automatically logged in with one and not with the other? Commented Dec 25, 2021 at 5:11

1 Answer 1

1
//span[contains(text(),'source')]

Would be the right xpath the class isn't source the text is.

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

6 Comments

hmmm .... still doesn't work Is it because of the default profile?
What website is it?
Was wondering what error did you get?
Cause if it's not found it could be shadowroots or frames.
|

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.