-1

How can use whatsapp xpath or css(Chromedriver) in vb.net.

HTML:

<span data-testid="send" data-icon="send" class>...</span> ==$0

xpath:

//*[@id="main"]/footer/div[1]/div/span[2]/div/div[2]/div[2]/button/span

I tried but not working:

driver.FindElement(By.CssSelector("span[data-testid='send' data-icon='send']")).Click()
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
jhon mojes
  • 9
  • 1
  • 3

2 Answers2

1

As per the HTML:

<span data-testid="send" data-icon="send" class>...</span>

To click on the element you can use either of the following Locator Strategies:

  • Using FindElementByCss:

    Driver.FindElementByCss("span[data-testid='send'][data-icon='send']").Click()
    
  • Using FindElementByXPath:

    Driver.FindElementByXPath("//span[@data-testid='send' and @data-icon='send']").Click()
    

References

You can find a couple of relevant detailed discussions in:

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
0

it should be like

driver.FindElement(By.CssSelector("span[data-testid='send'][data-icon='send']")).Click()

when select specific attributes :

span[data-testid='send']

to add attributes to same tag :

span[data-testid='send'][data-icon='send']

*no space between attributes

ammar alkotb
  • 194
  • 6