2016-11-29 202 views

回答

0

最好的辦法是,當你的輸入字段有一個ID。

那麼你只是去:

driver.findElement(By.Id("Your Id")).SendKeys("Your Text); 

你編輯了一個id。也許它會與他的ID一起工作。如果不是 ,並且您無法編輯該網站,並且您確定該網站不會被編輯,您可以使用XPath。 Firefox的插件(Selenium IDE)爲您自動生成XPath代碼。

check it out here.

否則使用類。 也許這個代碼將工作:

driver.findElement(By.ClassName("ql-editor)).sendKeys("Text);