我正在尝试使用URL启动chrome,浏览器启动,之后它什么都不做.
我在1分钟后看到以下错误:
Unable to open browser with url: 'https://www.google.com' (Root cause: org.openqa.selenium.WebDriverException: unknown error: DevToolsActivePort file doesn't exist
(Driver info: chromedriver=2.39.562718 (9a2698cba08cf5a471a29d30c8b3e12becabb0e9),platform=Windows NT 10.0.15063 x86_64) (WARNING: The server did not provide any stacktrace information)
Run Code Online (Sandbox Code Playgroud)
我的配置:
Chrome:66 ChromeBrowser:2.39.56
PS在Firefox中一切正常
selenium google-chrome webdriver selenium-chromedriver selenium-webdriver
我正在使用Apache的POI来使用Java操作Excel(.xls)文件.
我正在尝试创建一个新的单元格,其内容是公式的结果,就像用户复制/粘贴公式一样(我称之为"相对"方式,与"绝对"相反).
为了使自己更清楚,这里有一个简单的例子:Cell A1包含"1",B1包含"2",A2包含"3",B2包含"4".单元格A3包含以下公式"= A1 + B1".如果我将公式复制到excel下的A4单元格,它将变为"= A2 + B2":excel正在动态调整公式的内容.
不幸的是,我无法以编程方式获得相同的结果.我找到的唯一解决方案是将公式标记化并自己完成脏工作,但我真的怀疑这应该是这样做的.我无法在指南或API中找到我想要的内容.
有没有更简单的方法来解决这个问题?如果是这样的话,请指点我正确的方向吗?
最好的祝福,
尼尔斯
我在测试中作为SD工作.我是Appium Automation工具的新手,这个工具非常难为我设置环境.
我提到以下链接:: http://unmesh.me/category/appium/
这个链接帮助我通过命令行安装Node.js和appium.但我不确定这是正确的方法.
我从命令行得到以下消息:
mani-kandans-MacBook-Pro:platform-tools manikandan $ info:欢迎来到Appium v0.8.2(REV e9cc66197ad6a3496322bd77a8699509fc761b69)info:Appium REST http接口监听器在0.0.0.0:4723信息上启动 - socket.io已启动
在此之后我不知道.如何编写测试用例并通过Appium运行?
如果您有兴趣分享您对Appium工具的了解.请指导我.
我安装了Beautiful Soup库,
它似乎设置得很好,因为C:\ Python33\Lib\site-packages中有'bs4'文件夹.
(我在安装之前将名称更改为'bs4',安装后它的名称相同)
但是当我在代码中输入'from bs4 import beautifulsoup'时,它说没有这样的库.
我没有看到任何'beautifulsoup.py'或其他东西.是不是应该有一个?
我真的很困惑.有人帮忙吗?
我有以下HTML结构:
<button class="dropdown-toggle selectpicker btn btn-primary" data-toggle="dropdown" type="button" data-id="strategic_reseller_country" title="United States">
<div class="dropdown-menu open" style="max-height: 245.6px; overflow: hidden; min-height: 40px;">
<ul class="dropdown-menu inner selectpicker" role="menu" style="max-height: 243.6px; overflow-y: auto; min-height: 38px;">
<li class="" rel="0">
<a class="" style="" tabindex="0">
<span class="text"/>
<i class="glyphicon glyphicon-ok icon-ok check-mark"/>
</a>
</li>
<li rel="1">
<a class="" style="" tabindex="0">
<span class="text">Andorra</span>
<i class="glyphicon glyphicon-ok icon-ok check-mark"/>
</a>
</li>
<li rel="2">
<a class="" style="" tabindex="0">
<span class="text">United Arab Emirates</span>
<i class="glyphicon glyphicon-ok icon-ok check-mark"/>
</a>
</li>
<li …Run Code Online (Sandbox Code Playgroud) 我越来越异常了
线程"main"中的异常org.openqa.selenium.SessionNotCreatedException:无法创建新的远程会话.在尝试在远程Web驱动程序中运行selenium脚本时,所需的功能=功能[{marionette = true,browserName = firefox,version = 48.0.1,platform = ANY}],required capabilities = Capabilities [{}]'.
集线器和节点配置正确,并且能够相互通信.
Selenium Web驱动程序:3.0平台:Windows Server 2012 R2.Firefox版本:48.0.1
我脚本中使用的代码:
System.setProperty("webdriver.gecko.driver", "mypath/geckodriver.exe");
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability("marionette", true);
capabilities.setBrowserName("firefox");
capabilities.setPlatform(Platform.ANY);
RemoteWebDriver driver =new RemoteWebDriver(new URL("http://ipofthenode:4444/wd/hub"), capabilities);
driver.get("http://stackoverflow.com");
System.out.println("executed");
Run Code Online (Sandbox Code Playgroud)
详细的堆栈跟踪:
2017年6月19日下午6:07:36 org.openqa.selenium.remote.ProtocolHandshake createSession INFO:尝试双方言会议,假设Postel法则适用于远程端2017年1月19日下午6:07:37 org.openqa .selenium.remote.ProtocolHandshake createSession INFO:回归原始的OSS JSON Wire Protocol.2017年1月19日下午6:07:37 org.openqa.selenium.remote.ProtocolHandshake createSession INFO:回归直接W3C远程结束连接线程"main"中的异常org.openqa.selenium.SessionNotCreatedException:无法创建新的远程会话.desired capabilities = Capabilities [{marionette = true,browserName = firefox,version = 48.0.1,platform = ANY}],required capabilities = Capabilities [{}] Build info:version:'3.0.0',revision:'350cf60' ,时间:'2016-10-13 10:48:16 -0700'
所以这是我的 HTML 代码,我试图将 div 中输出的任何内容abc转换为可下载的 pdf 文件。
<!-- Page Heading -->
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">
Reports
</h1>
<ol class="breadcrumb">
<li>
<i class="fa fa-dashboard"></i> <a href="dashboard">Dashboard</a>
</li>
<li class="active">
<i class="fa fa-edit"></i> Reports
</li>
</ol>
<body>
<div id="abc">
</div>
<div id="editor"></div>
<button id="cmd">Download Survey Report</button>
<div id="abc">
</div>
</body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.3/jspdf.min.js"></script>
<script>
var doc = new jsPDF();
var specialElementHandlers = {
'#editor': function (element, renderer) {
return true;
}
};
$('#cmd').click(function () {
doc.fromHTML($('#abc').html(), 15, 15, { …Run Code Online (Sandbox Code Playgroud) 运行此 selenium 脚本时出现错误。请建议可以做些什么来解决这个问题:脚本:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import re
import csv
import time
driver = webdriver.chrome("<webdriver path>")
driver.get("https://www.google.com/")
driver.find_element_by_xpath('//*[@title="Search"]')
send_keys('abc')
driver.find_element_by_xpath('//*[@class="sbico _wtf _Qtf"]').click()
time.sleep(5)
driver.find_element_by_xpath('//[@id="rso"]/div[1]/div/div[1]/div/div/h3/a')
print(var)
Run Code Online (Sandbox Code Playgroud)
错误:
回溯(最近一次调用):文件“C:/Users/admin/Desktop/test2.py”,第 2 行,在 from selenium import webdriver ModuleNotFoundError: No module named 'selenium'
我已经在 win 7 Professional 32 位上安装了 Python 3.6。我有 Selenium 独立服务器版本 3.4.0(链接)
使用设置为
我按照spring boot和Vlad的链接配置我的应用程序,如下所示
db.properties-
jdbc.driverClassName = com.mysql.jdbc.Driver
jdbc.url = jdbc:mysql://hostname:port/appname?useSSL=false&serverTimezone=UTC&useLegacyDatetimeCode=false
jdbc.username = xxx
jdbc.password = xxx
jdbc.minPoolSize = 5
jdbc.maxPoolSize = 20
jdbc.maxIdleTime = 30000
hibernate.dialect = org.hibernate.dialect.MySQLDialect
hibernate.show_sql = true
hibernate.format_sql = false
spring.jpa.properties.hibernate.jdbc.time_zone = UTC
Run Code Online (Sandbox Code Playgroud)
HibernateConfig.java
@Configuration
@EnableTransactionManagement
@ComponentScan(basePackages="in.greenstack.ikon")
@PropertySource(value = { "classpath:/resources/db.properties" })
public class HibernateConfig {
@Autowired
private Environment environment;
@Bean(name = "myDataSource")
....
@Bean
public LocalSessionFactoryBean sessionFactory() {
LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean();
sessionFactory.setDataSource(dataSource());
sessionFactory.setPackagesToScan(new String[] …Run Code Online (Sandbox Code Playgroud) 在这里和其他地方已经有很多关于PhantomJS缺乏Function.prototype.bind方法的讨论,并且许多有用的慈善家已经编写过填充/填充或指向其他资源.我正在通过Selenium Webdriver和Python绑定实现PhantomJS.我已经尝试了几种方法来使用这种polyfill,但无济于事.目前我在我的webdriver继承测试器类中使用以下代码:
bindShim = """var script = document.createElement('script');
script.src = '/home/dunkin/scripts/es5-shim.js';***
script.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(script);
"""
self.execute_script(bindShim)
Run Code Online (Sandbox Code Playgroud)
我每次访问新页面时都会执行此代码.事实上,这种方法可以确保PhantomJS能够理解jQuery变量.但是,我仍然在我的PhantomJS驱动程序日志中看到以下内容:
[ERROR - 2015-02-10T17:43:44.068Z] Session [fd37e5c0-b14b-11e4-b9e3-5bbebfaf3f9d] - page.onError - msg: TypeError: 'undefined' is not a function (evaluating 'arguments.callee.bind(this,e)')
[ERROR - 2015-02-10T17:43:44.069Z] Session [fd37e5c0-b14b-11e4-b9e3-5bbebfaf3f9d] - page.onError - stack:
(anonymous function) (https://jsta.sh/media/all.js?1459:16)
t (https://jsta.sh/media/all.js?1459:16)
(anonymous function) (https://jsta.sh/media/all.js?1459:17)
(anonymous function) (https://jsta.sh/media/all.js?1459:8)
(anonymous function) (https://jsta.sh/media/all.js?1459:8)
(anonymous function) (https://jsta.sh/media/all.js?1459:8)
I (https://jsta.sh/media/all.js?1459:2)
Run Code Online (Sandbox Code Playgroud)
等等
我希望尽管与其他有关此.bind()问题的问题密切相关,但我的问题对于那些通常希望为其开箱即用的Selenium PhantomJS实现添加功能的人来说非常有用.如果我可以修改由我的Ghostdriver-PhantomJS-Selenium堆栈实现的JavaScript库,而不是直接将es5垫片添加到我访问的每个页面,我会喜欢它,但我不知道我该怎么做或者如果.如果我只是在裸PhantomJS上构建这个测试器而不是通过另一个框架过滤它,那么开始觉得这样的事情会更简单.
我的规格:我在Ubuntu 14.04 LTS(GNU/Linux 3.17.1-elastic x86_64)上通过Python 2.7使用Selenium版本1.43和PhantomJS 1.98.
***当我在phantomjs控制台中使用它时,es5-shim会产生以下有希望的结果:
phantomjs> console.log(Object.keys)
function keys() {
[native …Run Code Online (Sandbox Code Playgroud)