Как установить событие обмена или отправки события? - PullRequest
0 голосов
/ 04 ноября 2019

Попытка установить какое-либо значение в текстовом поле и событие отправки.

browser.executeScript(`document.querySelector("body > moo-shell > auto-app").shadowRoot.querySelector("section > auto-config").shadowRoot.querySelector("section:nth-child(2) > div > div:nth-child(2) > section:nth-child(1) > auto-schedules-field").shadowRoot.querySelector("div > vaadin-ext-time-picker:nth-child(1)").shadowRoot.querySelector("vaadin-combo-box-light > vaadin-time-picker-text-field").shadowRoot.querySelector("div > div:nth-child(2) > slot:nth-child(2) > input").value = "abcd";`);
//Dispatching change event
browser.executeScript(`document.querySelector("body > moo-shell > auto-app").shadowRoot.querySelector("section > auto-config").shadowRoot.querySelector("section:nth-child(2) > div > div:nth-child(2) > section:nth-child(1) > auto-schedules-field").shadowRoot.querySelector("div > vaadin-ext-time-picker:nth-child(1)").shadowRoot.querySelector("vaadin-combo-box-light > vaadin-time-picker-text-field").shadowRoot.querySelector("div > div:nth-child(2) > slot:nth-child(2) > input").dispatchEvent(new Event('change', { 'bubbles': true }));`);

var clickAddButton = `document.querySelector("body > moo-shell > auto-app").shadowRoot.querySelector("section > auto-config").shadowRoot.querySelector("section:nth-child(2) > div > div:nth-child(2) > section:nth-child(1) > auto-schedules-field").shadowRoot.querySelector("div > vaadin-button").shadowRoot.querySelector("#button").dispatchEvent(new Event('change', { 'bubbles': true }));`;
browser.executeScript(clickAddButton);
//Dispatching change event after clicking the add button
browser.executeScript(`document.querySelector("body > moo-shell > auto-app").shadowRoot.querySelector("section > auto-config").shadowRoot.querySelector("section:nth-child(2) > div > div:nth-child(2) > section:nth-child(1) > auto-schedules-field").shadowRoot.querySelector("div > vaadin-button").shadowRoot.querySelector("#button").click();`)

//Expected Result: Input box should turn red
//Actual Result: Value passes in the input box & clicked Add button but inputbox doesnot 
//turns red...same execution doing manually input box turns red.```
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...