在jekyll serve
一台机器上使用后,即可设置WEBrick服务器,并可从localhost:4000
该特定PC上访问该站点.
但是,我想知道如何从局域网中的其他机器访问此Web服务器,尤其是移动设备?在将代码推送到Github之前,我正试图在移动设备上测试jekyll网站.
我想找到这个链接"us states"的元素<h5>
.我在craigslist中尝试这个.任何帮助将受到高度赞赏
这是网址:http: //auburn.craigslist.org/
<html class="">
<head>
<body class="homepage w1024 list">
<script type="text/javascript">
<article id="pagecontainer">
<section class="body">
<table id="container" cellspacing="0" cellpadding="0"
<tbody>
<tr>
<td id="leftbar">
<td id="center">
<td id="rightbar">
<ul class="menu collapsible">
<li class="expand s">
<li class="s">
<li class="s">
<h5 class="ban hot">us states</h5>
<ul class="acitem" style="display: none;">
</li>
<li class="s">
<li class="s">
Run Code Online (Sandbox Code Playgroud) 使用Chrome Selenium-WebDriver时,它将在服务器启动时输出诊断输出:
在端口9515上启动ChromeDriver(v2.0)
我不想看到这些消息,我怎么能抑制它们呢?
我这样做
ChromeOptions options = new ChromeOptions();
options.AddArgument("--silent");
IWebDriver Driver = new ChromeDriver(options);
Run Code Online (Sandbox Code Playgroud)
但诊断输出不会被抑制.
c# selenium webdriver selenium-chromedriver selenium-webdriver
我必须使用Selenium WebDriver为100个用户执行负载测试.100个用户一次登录并点击服务器.
如何使用Selenium WebDriver完成此过程?
我想用不同的代理(iPhone,iPad,Android)测试用.NET编写的Web应用程序,我正在使用NUnit进行测试和Selenium.
任何人都有一个样本用c#或VB在Selenium中更改代理(例如iPad或iPhone)?
这是我正在使用的,用户代理可以成功设置,而下载首选项不能.
Windows 7,Chrome 26,Selenium-dotnet-2.31.2,chromedriver_win_26.0.1383.0
ChromeOptions chromeOptions = new ChromeOptions();
var prefs = new Dictionary<string, object> {
{ "download.default_directory", @"C:\code" },
{ "download.prompt_for_download", false }
};
chromeOptions.AddAdditionalCapability("chrome.prefs", prefs);
chromeOptions.AddArgument("--user-agent=" + "some safari agent");
var driver = new ChromeDriver(chromeOptions);
Run Code Online (Sandbox Code Playgroud)
取自chromedriver.log:
[1.201][FINE]: Initializing session with capabilities {
"browserName": "chrome",
"chrome.prefs": {
"download.default_directory": "C:\\code",
"download.prompt_for_download": false
},
"chrome.switches": [ "--user-agent=Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.57.2 (KHTML, like Gecko) Version..." ],
"chromeOptions": {
"args": [ "--user-agent=Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.57.2 (KHTML, like Gecko) Version..." …
Run Code Online (Sandbox Code Playgroud) 我下载了ChromeDriver,默认情况下浏览器语言是英文的,我需要将其更改为西班牙语,我一直无法使用.
public WebDriver getDriver(String locale){
System.setProperty("webdriver.chrome.driver", "driver/chromedriver.exe");
return new ChromeDriver();
}
public void initializeSelenium() throws Exception{
driver = getDriver("en-us")
}
Run Code Online (Sandbox Code Playgroud) 哪个是打开Url的首选方法(并且幕后有任何差异):
driver.Url = "http://example.com";
Run Code Online (Sandbox Code Playgroud)
要么
driver.Navigate().GoToUrl("http://example.com");
Run Code Online (Sandbox Code Playgroud)
此外,如果驱动程序已经指向同一页面,是否会再次设置Url会导致页面刷新?
即
...
driver.Url = "http://example.com";
driver.Url = "http://example.com"; //does this reload the page?
...
Run Code Online (Sandbox Code Playgroud)
FWIW我正在使用Chrome驱动程序chromedriver.exe,但它似乎不是一个托管程序集(我尝试用ILSpy打开它但没有运气).
尝试在ipython笔记本中使用Selenium打开Firefox时出错.我环顾四周,发现了类似的错误,但没有什么能与我得到的错误完全匹配.有人知道问题可能是什么以及我如何解决它?我正在使用Firefox 22.
我输入的代码如下:
from selenium import webdriver
driver = webdriver.Firefox()
Run Code Online (Sandbox Code Playgroud)
代码返回的错误如下:
WindowsError Traceback (most recent call last)
<ipython-input-7-fd567e24185f> in <module>()
----> 1 driver = webdriver.Firefox()
C:\Anaconda\lib\site-packages\selenium\webdriver\firefox\webdriver.pyc in __init__(self, firefox_profile, firefox_binary, timeout, capabilities, proxy)
56 RemoteWebDriver.__init__(self,
57 command_executor=ExtensionConnection("127.0.0.1", self.profile,
---> 58 self.binary, timeout),
59 desired_capabilities=capabilities)
60 self._is_remote = False
C:\Anaconda\lib\site-packages\selenium\webdriver\firefox\extension_connection.pyc in __init__(self, host, firefox_profile, firefox_binary, timeout)
45 self.profile.add_extension()
46
---> 47 self.binary.launch_browser(self.profile)
48 _URL = "http://%s:%d/hub" % (HOST, PORT)
49 RemoteConnection.__init__(
C:\Anaconda\lib\site-packages\selenium\webdriver\firefox\firefox_binary.pyc in launch_browser(self, profile)
45 self.profile = profile
46
---> …
Run Code Online (Sandbox Code Playgroud) 我非常感谢有关如何使用Selenium Webdriver通过C#连接到已打开的浏览器的指南.
这个问题占我脚本开发时间的30%左右!
selenium ×9
webdriver ×7
c# ×4
.net ×1
github ×1
java ×1
jekyll ×1
load-testing ×1
python ×1
ruby ×1
user-agent ×1
web-scraping ×1
webrick ×1