• 关于页面元素不能定位,通过Js进行处理


    public class Test {
    public static void main(String[] args) throws Exception {
    File file = new File("C:\Users\HP\AppData\Roaming\Mozilla\Firefox\Profiles\y0iw24je.default");
    FirefoxProfile profile = new FirefoxProfile(file);
    WebDriver driver = new FirefoxDriver(profile);
    driver.manage().window().maximize();
    driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
    ................................................
    WebElement element = driver.findElement(By.cssSelector("select[id='programType']"));
    JavascriptExecutor js = (JavascriptExecutor)driver;
    js.executeScript("document.getElementById('programType').value='1'");
    js.executeScript("document.getElementById('orderStatus').value='PASS,SUPPLY'");
    js.executeScript("document.getElementById('queryBtn').click()");--js实现点击世间onclick()/click
    Thread.sleep(3000);
    }
    }

    补充修改select option的值

    document.getElementById('identifyType').value='统一社会信用代码'

    修改select选择的文本值:

    document.getElementById('borrowerType')[1].text='机构'

  • 相关阅读:
    使用SVG symbols建立图标系统完整指南
    ural 1874 Football Goal
    ural 1572 Yekaterinozavodsk Great Well
    ural 1084 Goat in the Garden
    ural 1192 Ball in a Dream
    ural 1020 Rope
    ural 1494 Monobilliards
    ural 1671 Anansi's Cobweb
    ural 1613 For Fans of Statistics
    ural 1126 Magnetic Storms
  • 原文地址:https://www.cnblogs.com/jackyu126/p/7595861.html
Copyright © 2020-2023  润新知