1

テキストボックスを呼び出してみました。しかし、次のエラーが表示されます: 要素が見つかりません: {"method":"id","selector":"sysPublishDateDate"}

ここに来て、これで私のコードを添付しています:

        try{
        WebElement title = driver.findElement(By.xpath("//div[@id='widget_title']//input[@id='title']"));
        title.sendKeys("Automation");
        WebElement browse = driver.findElement(By.xpath("//div[@id='listingThumbnail']//span[@id='dijit_form_Button_14']"));
        browse.click();
        driver.manage().timeouts().implicitlyWait(150,TimeUnit.SECONDS);    
        try{
            List<WebElement> sidemenu = driver.findElements(By.xpath("//*[@id='dijit_layout_ContentPane_6']"));
            for(WebElement drop:sidemenu){
                System.out.println(drop.getText());
            }

        }catch(Exception e){

        }

        WebElement file = driver.findElement(By.xpath("//*[@id='dijit_layout_ContentPane_6']//div[5]/div[@class='dijitTreeRow']/img"));
        file.click();
        driver.manage().timeouts().implicitlyWait(150,TimeUnit.SECONDS);    
        WebElement thumbnails = driver.findElement(By.xpath("//*[@id='dotcms_dijit_FileBrowserDialog_2-tree-treeNode-3bc7e461-117f-4f0c-96fe-8edb24ec6cde']/div[1]"));
        thumbnails.click();
        driver.manage().timeouts().implicitlyWait(150,TimeUnit.SECONDS);
        WebElement  image = driver.findElement(By.xpath("//*[@id='file-5a88cc64-dd56-4d40-8778-8df7fb2f233d0']/a/img"));
        image.click();
        driver.manage().timeouts().implicitlyWait(150, TimeUnit.SECONDS);
        driver.switchTo().defaultContent();
        WebDriver myFrame= driver.switchTo().frame(driver.findElements(By.tagName("iframe")).get(0));
        WebElement summary = myFrame.findElement(By.xpath("//*[@id='tinymce']"));
        summary.sendKeys("Testing DotCMS");         
        //WebElement story = driver.findElement(By.xpath("//table[@id='story_tbl']//td[@class='mceIframeContainer mceFirst mceLast']/iframe"));

        try{
            driver.switchTo().defaultContent();
            WebDriver myframe = driver.switchTo().frame(driver.findElement(By.xpath("//*[@id='story_ifr']")));
            WebElement story = myframe.findElement(By.xpath("//*[@id='tinymce']"));
            story.sendKeys("Testing DotCMS Automation");
           }catch (Exception e){
            System.out.println("iframe not found");
        }

        }catch (Exception e){

    }

    driver.manage().timeouts().implicitlyWait(150, TimeUnit.SECONDS);
    WebElement dateselection = driver.findElement(By.id("sysPublishDateDate"));
    dateselection.clear();
    dateselection.sendKeys("8/7/2013",Keys.ENTER);

この行でエラーが発生しています。 WebElement dateselection = driver.findElement(By.id("sysPublishDateDate")); dateselection.clear(); dateselection.sendKeys("8/7/2013",Keys.ENTER);

このコードでは、値を入力するだけです。また、このために Frames と iframes を特定しようとしましたが、何もブロックしていません。解決策を見つけるためにこれに行き詰まりました。

4

1 に答える 1