Question: I need to count the words occurring in an observation. Some observations have only one word, but others have more than one and are separated by "/".

Here is a data set for a reproducible example.

```
data.1 <-read.csv(text = "
obs, a
2, date
3, Ari
4, MO
5, date/Ari
6, date/MO
7, Ari/MO
8, date/Ari/MO
")

```

This is the solution I came up with. But this solution is not counting correctly those observations with only one word.

```
data.2 <-  data.1 %>% 
              mutate(n.words = lengths(gregexpr("/", a)) + 1)

```

This is the output

[![enter image description here](https://i.stack.imgur.com/7Sj8o.png)](https://i.stack.imgur.com/7Sj8o.png)

Any help will be really appreciated.

Thanks.

Answer: 
There are multiple xpath patters that could work, this is one that's close to the one in your question.

```
driver.find_element_by_xpath('//button[@class="btn btn-gradient-primary btn-icon-text p-3 col-12"][text(),"New request"]')

```
Do you have the option to put an id on your button and do it like this?

```
driver.find_element_by_id(<id_of_button>)

```

EDIT:

How about this?

```
driver.find_element_by_xpath('//button[@class="icon-plus btn-icon-prepend"][.="New request"]').click()

```