相关疑难解决方法(0)

Selenium - Python - 下拉菜单选项值

我需要从下拉菜单中选择一个元素.

例如,打开这个:

<select id="fruits01" class="select" name="fruits">
  <option value="0">Choose your fruits:</option>
  <option value="1">Banana</option>
  <option value="2">Mango</option>
</select>
Run Code Online (Sandbox Code Playgroud)
  1. 所以首先我要点击它.我这样做:

    inputElementFruits = driver.find_element_by_xpath("//select[id='fruits']").click()
    
    Run Code Online (Sandbox Code Playgroud)

(好吧,打开菜单)

  1. 在我必须选择好元素之后,让我们说芒果.我尝试了不同的东西,Mango但它没有用.

python selenium webdriver web-scraping selenium-webdriver

146
推荐指数
9
解决办法
21万
查看次数

Chrome无法访问Selenium WebDriver错误

我正面临这个问题; 我知道这个问题已经出现了,我已经尝试了所提到的解决方案,因此请问我的配置和代码.

之前脚本正在运行,但现在它们不是,所以我尝试制作一个基本的开放浏览器脚本.

最新版本的Selenium WebDriver:http://selenium-release.storage.googleapis.com/3.5/selenium-java-3.5.0.zip

ChromeDriver上的最新版本:http://chromedriver.storage.googleapis.com/index.html?path = 2.31 /

基本打开浏览器代码:

package Trial;

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class Trial_Class {
    public static void main(String args[]){
        System.setProperty("webdriver.chrome.driver", "chromedriver.exe");
        WebDriver driver = new ChromeDriver();
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
        driver.get("http://www.youtube.com");
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

    }
}
Run Code Online (Sandbox Code Playgroud)

但我仍然得到以下错误:

 Starting ChromeDriver 2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8) on port 43967
Only local connections are allowed.
Exception in thread "main" org.openqa.selenium.WebDriverException: chrome not reachable
  (Driver info: chromedriver=2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform=Windows NT 6.3.9600 x86_64) (WARNING: The server did not provide …
Run Code Online (Sandbox Code Playgroud)

selenium-chromedriver selenium-webdriver

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

WebDriverException:消息:未知错误:Chrome 无法启动:在 Amazon Linux 上通过 Selenium Python 使用 ChromeDriver Chrome 发生崩溃错误

python linux selenium google-chrome selenium-chromedriver

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