Java+Selenium之KSampleOfCM

package scc.com.sample;

import com.dn.UI.KeyWordsOfWeb;

public class SampleOfCM {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        KeyWordsOfWeb cm = new KeyWordsOfWeb();
        cm.openBrowser("chrome");
        cm.halt(1000);
        cm.setWindow();
        cm.halt(1000);
        cm.getUrl("https://baidu.com/");
        cm.halt(1000);
        cm.inputByXpathAndSubmit("//*[@id='kw']", "网易云音乐");
        cm.halt(1000);
        cm.clickByXpath("//*[@id=\"1\"]/h3/a[1]");
        cm.halt(1000);
        cm.switchWindow("网易云音乐");
        cm.halt(2000);
        cm.mouseOn("//*[text()='登录']");
        cm.halt(1000);
        cm.clickByXpath("//em[text()='QQ登录']");
        cm.halt(1000);
        cm.switchWindow("QQ帐号安全登录");
        cm.halt(1000);
        cm.selectIframe("//*[@id=\"ptlogin_iframe\"]");
        cm.halt(1000);
        cm.clickByXpath("//*[@id=\"img_out_1346961182\"]");
        cm.halt(3000);
        cm.switchWindow("网易云音乐");
        cm.halt(3000);
        cm.runJs("document.getElementsByClassName('ph j-flag')[0].innerHTML=\"慢慢喜欢你\"");
        //cm.runJs("document.getElementsByClassName('ph j-flag')[0].innerHTML=\"慢慢喜欢你\".focus()");
        //cm.assertByText("//a[@href='/user/home?id=122753066' and @class='nm nm-icn f-fs1 f-ib f-thide']", "SundayGirl");
        //cm.screenShot("1");
        cm.halt(2000);
        cm.saveScrShot();
        cm.halt(2000);
        cm.srcoll();
        cm.halt(2000);
        cm.closeBrowser();
        
        

    }

}

 

转载于:https://www.cnblogs.com/lemom/p/11484845.html

你可能感兴趣的:(python,java,ui)