2017-06-08 4 views
0

私はOdoo posアプリケーションを自動化しています。カートに商品を追加しているうちに、「ポイントがクリックできない(659,166)」というエラーが表示されます。私はすでに1つのアイテムを作成してカートに追加しようとしていますが、要素は見つかりません。助けが必要。私はOdooアプリケーションを自動化する際に問題があります

 package odoo1; 

import java.util.List; 
import java.util.concurrent.TimeUnit; 

import org.openqa.selenium.Alert; 
import org.openqa.selenium.By; 
import org.openqa.selenium.Capabilities; 
import org.openqa.selenium.NoAlertPresentException; 
import org.openqa.selenium.WebDriver; 
import org.openqa.selenium.WebDriverException; 
import org.openqa.selenium.WebElement; 
import org.openqa.selenium.chrome.ChromeDriver; 
import org.openqa.selenium.chrome.ChromeOptions; 
import org.openqa.selenium.firefox.FirefoxDriver; 
import org.openqa.selenium.ie.InternetExplorerDriver; 
import org.openqa.selenium.interactions.Actions; 
import org.openqa.selenium.support.ui.ExpectedConditions; 
import org.openqa.selenium.support.ui.Select; 
import org.openqa.selenium.support.ui.Wait; 
import org.openqa.selenium.support.ui.WebDriverWait; 

public class odoo { 

    public static void main(String[] args) throws InterruptedException { 
     System.setProperty("webdriver.chrome.driver","C:\\Chrome\\chromedriver.exe"); 
     ChromeOptions options = new ChromeOptions(); 
     options.addArguments("start-maximized"); 
     options.addArguments("disable-infobars"); 
     WebDriver driver = new ChromeDriver(options); 



     driver.manage().timeouts().implicitlyWait(50, TimeUnit.SECONDS); 



     // for Log in functionality 
     driver.get("https://www.odoo.com/trial?selected_app=point_of_sale"); 
     driver.findElement(By.id("username")).sendKeys("mark"); 
     driver.findElement(By.id("email")).sendKeys("[email protected]"); 
     driver.findElement(By.id("company-name")).sendKeys("odooo"); 
     driver.findElement(By.id("phone")).sendKeys("561234897"); 
     driver.findElement(By.id("country-id")).sendKeys("India"); 
     driver.findElement(By.name("lang")).sendKeys("English"); 
     Select sell=new Select(driver.findElement(By.name("company_size"))); 
     sell.selectByIndex(2);; 
     Select sell1=new Select(driver.findElement(By.id("plan"))); 
     sell1.selectByIndex(2); 
     driver.findElement(By.xpath(".//*[@id='wrapwrap']/main/div/div/div[2]/div[2]/div/form/input[8]")).click(); 

     // for creating product 

    driver.findElement(By.xpath("html/body/div[3]/div[3]/div[1]/a[2]/div[2]")).click(); 
    driver.findElement(By.xpath("html/body/nav/div/ul[1]/li[2]/a")).click(); 
    driver.findElement(By.xpath("html/body/nav/div/ul[1]/li[2]/ul/li[3]/a/span")).click(); 
    driver.findElement(By.xpath("html/body/div[3]/div[2]/div[1]/div/button")).click(); 
    driver.findElement(By.xpath(".//*[@id='o_field_input_4']")).sendKeys("iphone"); 
    driver.findElement(By.xpath(".//*[@id='o_field_input_4']")).click(); 
    driver.findElement(By.xpath(".//*[@id='o_field_input_13']")).sendKeys("abcd"); 
    driver.findElement(By.xpath(".//*[@id='o_field_input_14']")).sendKeys("123456"); 
    driver.findElement(By.xpath(".//*[@id='o_field_input_15']")); 
    driver.findElement(By.xpath(".//*[@id='o_field_input_16']")).clear(); 
    driver.findElement(By.xpath(".//*[@id='o_field_input_16']")).sendKeys("25000"); 
    driver.findElement(By.xpath(".//*[@id='o_field_input_20']")).clear(); 
    driver.findElement(By.xpath(".//*[@id='o_field_input_20']")).sendKeys("25000"); 
    Thread.sleep(1000); 
    driver.findElement(By.xpath("html/body/div[3]/div[2]/div[1]/div/div[2]/button[1]")).click(); 



    Thread.sleep(900); 
    driver.findElement(By.xpath("html/body/nav/div/ul[1]/li[1]/a/span")).click(); 

    driver.findElement(By.xpath("html/body/div[4]/div/div/div[1]/div[2]/div/div[1]/button")).click(); 
    Thread.sleep(500); 
    driver.findElement(By.xpath("html/body/div[1]/div[2]/div/div[2]/div[1]/div/div/div/div[2]/div[2]/table/tbody/tr[2]/td/div/div/div/div/span[2]/div[1]")).click(); 


    Thread.sleep(700); 
    driver.findElement(By.xpath("//button")).click(); 

    Thread.sleep(5000); 



    driver.findElement(By.xpath("html/body/div[1]/div[2]/div/div[2]/div[1]/div/div/div/div[2]/div[2]/table/tbody/tr[2]/td/div/div/div/div/span[2]/div[1]/img")).click(); 

    } 


    } 
+0

エラースタックトレースと一緒にコードを共有する必要があります –

+0

コードとその要素のHTMLを共有します。試したことを分かち合うと良いでしょう。 – SaiPawan

+0

私はOdoo [https://store.webkul.com](https://store.webkul.com/)のサイトをチェックしましたが、カートはクリックできませんでしたが、マウスを動かすとあなたの行動を使用する必要があると思う[http://www.seleniumeasy.com/selenium-tutorials/how-to-perform-mouseover-action-in-selenium-webdriver](http:/) /www.seleniumeasy.com/selenium-tutorials/how-to-perform-mouseover-action-in-selenium-webdriver)。詳細はこのリンクを参照してください –

答えて

0

例外を見ると、正しいパスが選択されていないように見えます。 私はあなたが自動化しようとしているウェブサイトをチェックしました。

  1. クリックして開きカートタブ上:私は続いている

    手順。

  2. 配送オプションを選択します。
  3. をクリックしてください。カートに入れるパスに追加する製品の

カートに追加]ボタンに使用したXpath:

// H3 [正規化空間を()= "Opencartマーケットプレース"] /../ DIV [3] //ボタン

私は「Opencart Marketplace」という製品を選択しました。任意の製品を選択できます。 Opencart Marketplaceの商品を選択してください。

コード:

するSystem.setProperty( "webdriver.gecko.driver"、 "SRC/geckodriver");

WebDriver driver = new FirefoxDriver();

driver.get( "https://store.webkul.com/OpenCart-Modules.html");

Thread.sleep(2);

driver.findElement(By.xpath( "// h3 [normalize-space()= 'Opencart Marketplace] /../ div [3] //ボタン))。

driver.findElement(By.xpath( "// class = 'product_cart_container')/ button"))click();

関連する問題