小编use*_*083的帖子

使用selenium webdriver从网页中检索元描述的内容

想要使用webdriver获取页面元描述的内容.

让我们说,从DOM下面想要检索文本 Test.com provides a complete software solution for creating online tests and managing enterprise and specialist certification programs, in up to 22 languages

<script src="content/js/jquery.min.js">
<meta content="Test.com provides a complete software solution for creating online tests and managing enterprise and specialist certification programs, in up to 22 languages." name="description">
<meta content="Test.com" name="keywords">
Run Code Online (Sandbox Code Playgroud)

我试过了

System.out.println(driver.findElement(By.xpath("//meta[@name='description']")).getText());
Run Code Online (Sandbox Code Playgroud)

但上面的代码对我不起作用.

java selenium xpath webdriver selenium-webdriver

10
推荐指数
1
解决办法
6136
查看次数

如何在 Cypress 中通过 TypeScript 项目使用 xpath 定位器?

最初,xpath 插件在我的 cypress 项目中运行良好。安装了 Typescript 插件并从 javascript 移至 Typescript。现在它开始在 xpath 上抛出错误

Property 'xpath' does not exist on type 'cy & EventEmitter'.ts(2339)
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

请建议,如何在 Cypress 项目中将 xpath 与 typescript 一起使用? cypress-xpath": "^1.6.2",包含在 package.json 中

package.json文件如下:

"devDependencies": {
    "@types/node": "^14.17.8",
    "add": "^2.0.6",
    "cypress-cucumber-preprocessor": "^4.3.0",
    "cypress-mochawesome-reporter": "^2.2.0",
    "cypress-xpath": "^1.6.2",
    "typescript": "^4.4.3",
    "yarn": "^1.22.10"
  },
  "cypress-cucumber-preprocessor": {
    "nonGlobalStepDefinitions": true
  }
Run Code Online (Sandbox Code Playgroud)

xpath typescript cypress cypress-cucumber-preprocessor

4
推荐指数
1
解决办法
2992
查看次数

org.openqa.selenium.InvalidArgumentException:未知错误:不支持的协议

我添加了网页中的所有链接Arraylist,然后一一点击所有网址。

public class Redirectionlinked1 
{
    public static List findAllLinks(WebDriver driver)
    { 
        List <WebElement> elementList = new ArrayList();
        elementList = driver.findElements(By.tagName("a"));
        elementList.addAll(driver.findElements(By.tagName("img")));

        List finalList = new ArrayList();
        for(WebElement element : elementList)
        {
            if (element.getAttribute("href") != null)
            {
                finalList.add(element);
            }
        }
        return finalList;
    }

    public static void main(String[] args) throws Exception 
    {
        System.setProperty("webdriver.gecko.driver", "E:\\Softwares\\gecko\\geckodriver-v0.16.1-win64\\geckodriver.exe");
        System.setProperty("webdriver.chrome.driver", "E:\\chromedriver.exe");

        WebDriver driver = new ChromeDriver();
        driver.get(" http://testsite.com");
        List <WebElement > allImages = findAllLinks(driver);

        System.out.println("Total number of elements found " + allImages.size());
        driver = new …
Run Code Online (Sandbox Code Playgroud)

java arrays selenium webdriver selenium-webdriver

2
推荐指数
1
解决办法
5万
查看次数

Hive ODBC Connector的重要性是什么?

我喜欢理解'Hive ODBC Connector'的概念.意味着在架构中使用Hive ODBC Connector有什么用处.

是否需要设置DSN(数据源名称).我们可以进行无DSN配置吗?

请详细说明

odbc hadoop hive

1
推荐指数
1
解决办法
950
查看次数

RobotFramework : AttributeError: 'list' 对象没有属性 'startswith'

使用 RobotFramework,

我正在尝试使用 FOR 循环检索 Webelements 标签。

${temp}=    Get WebElements    xpath=//*[@class='ui-grid-canvas']
Set Global Variable    ${temp}
${as}    Get Element Count    xpath=//*[@class='ui-grid-canvas']
: FOR    ${ELEMENT}    IN    ${temp}
\    ${as}=    Get Text    ${ELEMENT}
Run Code Online (Sandbox Code Playgroud)

我在 FOR 循环中出错。请纠正我。

AttributeError: 'list' object has no attribute 'startswith'
Run Code Online (Sandbox Code Playgroud)

python selenium robots.txt robotframework

1
推荐指数
1
解决办法
2185
查看次数