Python中文
首页
教程
问答
标签
搜索
登录
注册
在ubuntu中使用python selenium的“save_screenshot”未设置文件路径
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>我使用pythonselenium来获取测试的屏幕截图,但是在ubuntu中保存的屏幕截图是以路径名作为文件名并保存在桌面上的。我在windows上使用了相同的代码,文件保存在正确的目标中:</p> <pre><code>def shot(): ts = time.time() path = "\home\sudhanshu\Desktop\shots\sb" extension = ".png" screensave = datetime.datetime.fromtimestamp(ts).strftime('%d%m%Y%H%M%S') print (path+screensave+extension) wd.save_screenshot(path+screensave+extension) </code></pre> <p>在这里,如果您看到路径,我想将带有时间戳的文件保存在桌面上名为shots的文件夹中,但它将完整路径作为文件名保存在桌面上。同样的东西在windows上也能很好地工作。我尝试过以不同的方式添加路径,比如将<code>~\sudhanshu\Desktop\shots06062017170730.png</code>设置为路径,但是没有任何效果。谁能给我提个建议吗。在</p>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>使用/和使用重新开始工作os.path.join操作系统一起。谢谢大家。在</p>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
如何在乒乓球比赛中预测球的轨迹,对于AI球拍预测?
10 回答
如何在乒乓球游戏中阻止球
10 回答
如何在乘法和模中不乘空间?
8 回答
如何在乘法和除以2个不同的数字之间进行交换?
9 回答
如何在也是数据一部分的单个字符上拆分大字符串
7 回答
如何在乾草堆中找到針,有更好的解決方案嗎?
10 回答
如何在事件wxWidgets中传递自定义数据
1 回答
如何在事件中使用lambda i=i?
6 回答
如何在事件中心只接收最近的数据
7 回答
如何在事件发生之前保持云函数运行?
1 回答
如何在事件发生后使页面重定向到同一页面
7 回答
如何在事件回调之间保持python生成器的状态
8 回答
如何在事件处理程序(pythonsocket、sphinx)中保留docstring
10 回答
如何在事件处理程序中更改wxRichTextCtrl的光标位置?
1 回答
如何在事件处理程序中访问外部对象?
5 回答
如何在事件循环中将协程打包为正常函数?
4 回答
如何在事件循环之外运行协同程序?
9 回答
如何在事件循环结束时为并发未来的所有线程调用类方法?
1 回答
如何在事件文件中只保留一份摘要?
4 回答
如何在事件模板中添加事件
5 回答