以下のSelenium WebdriverコードのUnsupported Command Exceptionが表示されています。私はコンテキストクリックのオプションをgoogleにしようとしましたが、私が書いたコードがコンテキストクリックに関して正しいかどうかを確認することができました。コンテキストがセレンでクリック
ここで私が紛失しているものについて理解してください。
package DataProvider;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.UnsupportedCommandException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Action;
import org.openqa.selenium.interactions.Actions;
public class UISelect {
public static void main(String args[]) throws InterruptedException
{
System.setProperty("webdriver.gecko.driver", "C:/Users/Madankumar/Desktop/Gecko Driver/geckodriver.exe");
WebDriver driver=new FirefoxDriver();
driver.navigate().to("http://www.google.com");
driver.manage().window().maximize();
WebElement oWE=driver.findElement(By.linkText("About"));
Actions oAction=new Actions(driver);
oAction.moveToElement(oWE);
oAction.contextClick(oWE).sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.ENTER).build().perform();
}
}
ご回答ありがとうございます。 sendKeysとexecute_scriptのコードスニペットを教えてください。 – Madan
答えは例で編集されました。 execute_scriptはpythonコマンドです。私はjavaコマンドをexecuteScriptに変更しました。 – Matts