Javascript 如何使用selenium在c#中编辑web元素属性值

Javascript 如何使用selenium在c#中编辑web元素属性值,javascript,c#,selenium-webdriver,Javascript,C#,Selenium Webdriver,例如: 如何使用SeleniumWeb驱动程序更改“value”属性的值 有没有类似的方法: IWebElement search\u cargo=driver.FindElement(By.Id(“cargo\u q”)); search_cargo.setAttribute(属性名称、属性新值);" ?使用JavascriptExecutor类: JavascriptExecutor js = (JavascriptExecutor) driver; //Driver is the We

例如:


如何使用SeleniumWeb驱动程序更改“value”属性的值

有没有类似的方法: IWebElement search\u cargo=driver.FindElement(By.Id(“cargo\u q”)); search_cargo.setAttribute(属性名称、属性新值);"
?使用JavascriptExecutor类:

JavascriptExecutor js = (JavascriptExecutor) driver; //Driver is the WebDriver object
js.executeScript("document.getElementById('cargo_q').setAttribute('value', '10')");