greenee
greenee

Reputation: 7

Trying to click in the message box using selenium webdriver

Trying to click on the message box for every new message window that pops up. However it seems as if the id changes every time. How do I get this to work for everytime a new message box pops up.

Here is what I tried:

passMessage = browser.find_element_by_css_selector('ember-text-area msg-messaging-form__message ember-view')

For example:

<textarea name="message" spellcheck="true" required="" placeholder="Write a message or attach a file" id="a11y-ember8470" class="ember-text-area msg-messaging-form__message ember-view"></textarea>

<textarea name="message" spellcheck="true" required="" placeholder="Write a message or attach a file" id="a11y-ember8492" class="ember-text-area msg-messaging-form__message ember-view"></textarea>

Upvotes: 0

Views: 647

Answers (1)

Nodir Rashidov
Nodir Rashidov

Reputation: 732

It is a css class name, so you need a dot:

passMessage = browser.find_element_by_css_selector('.ember-text-area.msg-messaging-form__message.ember-view');

http://selenium-python.readthedocs.io/api.html#module-selenium.webdriver.common.action_chains

Upvotes: 3

Related Questions