发表文章

[Python] 捕获屏幕上的黑白图像 Black - White Image on capturing screen[SeleniumLibrary]

iradovanovic 2017-10-9 51

大家好

因为最近我们有一个问题与截图, 但只有当测试是执行与詹金斯。
捕获的图像如下: 左边是白色, 右边是黑色。这就是全部。当我在同一 maschine (VM) 上手动运行时, 它工作正常。 有什么想法吗?

原文:

Hi all,

since recently we have a problem with screenshots but only when the test is executed with Jenkins.
Captured image looks like this: left side is white, right is black. That is all. When I run manually on same maschine (VM) it works. Any ideas?

相关推荐
最新评论 (23)
aaltat 2017-10-9
1

不是真的好主意, 以前没见过。但我能做出有教养的猜测是运行詹金斯的窗口还是 Linux?有显示吗?你试过用不同的浏览器吗?您更新了硒和浏览器驱动程序吗?

同样, 在用户群中询问是一个好主意, 因为你的问题得到了更多的观众。

原文:

Not really good ideas, haven't seen that one before. But I can make educated guesses. Is it a Windows or Linux that is running Jenkins? Does it have a display? Have you tried with different browsers? Have you updated Selenium and browser driver?

Also asking in user group would be good idea, because you get wider audience for your question.

iradovanovic 2017-10-9
2

你好。
它是一个视窗虚拟机 (赢 8)。铬驱动和硒的最新。
因为是从奴隶在 vm 上运行有一个屏幕 (与屏幕我的意思是, 如果你连接到该 VM, 你会看到浏览器和执行), 我们只使用 Chrome。

用户组是指 google 集团吗?

我也想在这里报告这个问题。

原文:

Hi.
It is a Windows virtual machine (Win 8). Chrome driver and selenium up to date.
Since is running from Slave on VM there is a screen (with screen i mean, if you connect to that VM you will see browser and executions) We use only Chrome.

By user group you mean google group?

I wanted also here to report the problem.

aaltat 2017-10-9
3

如果您注销然后显示也死, 并且它也影响到屏幕捕获。在 Windows 7 中, 可以将登录会话定向到控制台, 以便显示不会死。但是我没有赢8的经验。

是的, 我指的是 Google 用户组。

原文:

If you logout then the display also dies and it affects also to the screen captures. In Windows 7 it is possible direct the login session to the console so that the display does not die. But I don't have any experience with Win 8.

Yes I was referring to the Google user group.

aaltat 2017-10-9
4

你把问题解决了吗?

原文:

Did you get the problem solved?

iradovanovic 2017-10-9
5

还没有。今天, 我试图导入图书馆浏览器, 并使用 "截图" 从那一个。明天我将检查是否是与詹金斯工作。我对图像路径有问题。

原文:

Not yet. Today, i tried to import Library Browser and to use "Take Screenshot" from that one. Tomorrow i will check if is working with jenkins. I had a problem with image path.

iradovanovic 2017-10-9
6

还行。新的更新。当我手动登录到 VM, 并观看机器人正在执行, 然后图像被捕获。否则是黑 |白色的图像。

我必须找到更新或更改的内容。

原文:

Ok. New update. When i'm manually logged in to the VM and watching while robot is executing, then the image is captured. Otherwise is black | white image.

I have to find what is updated or changed.

aaltat 2017-10-9
7

在 windows 7 中, 我可以这样做: tscon.exe RDP-Tcp#0 /dest:console 转移到桌面到控制台。

原文:

In windows 7 I can do this: tscon.exe RDP-Tcp#0 /dest:console to divert to desktop to the console.

willmiraglia 2017-10-9
8

我也看到了这个问题。它始于10天前, 我一直无法弄清到底发生了什么。它刚刚开始发生过夜, 我没有触及我的环境配置。

我现在看到的空白截图在我的报告时运行詹金斯作为一个服务和测试是无头。(不会发生, 如果我登录到机器和运行测试显示)-我可以确认它发生在 Chrome 的时刻。我还没能用火狐来运行无头测试。

我改变了詹金斯服务属性 "允许服务与桌面交互"-但仍未修复它。这是一个很长的镜头, 因为以前 screehshots 工作的罚款没有这一组。


OS-Windows 服务 2012 R2 标准 = x64 基于的个人计算机
Chrome 版本: 版本 59.0. 3071.115 (正式修造) (64 位)

切----剪----
詹金斯版本2.60。1
ChromeDriver 2.30
robotframework (3.0.2)
robotframework-imaplibrary (0.2.3)
robotframework 骑 (1.5.2.1)
robotframework-selenium2library (1.8.0)
robotframework-sshlibrary (2.1.2)
硒 (3.4.3)

screen shot 2017-07-06 at 10 25 51 am

screen shot 2017-07-06 at 10 39 25 am

原文:

I'm seeing this issue too. It started about 10 days ago and I've not been able to figure out whats going on. It just started to occur overnight and I did not touch the configuration of my environment.

I now see blank screenshots in my reports when running Jenkins as a service and the tests are headless. ( doesn't happen if I log into the machine and run the tests with a display) - I can confirm it happens in Chrome at the moment. I've not been able to run headless tests yet with Firefox.

I changed jenkins service properties 'Allow service to interact with desktop' - but still didn't fix it. This was a long shot as previously screehshots worked fine without this set.


OS-Windows Service 2012 R2 standard = x64 based PC
Chrome version: Version 59.0.3071.115 (Official Build) (64-bit)

cut ----------------
Jenkins version 2.60.1
ChromeDriver 2.30
robotframework (3.0.2)
robotframework-imaplibrary (0.2.3)
robotframework-ride (1.5.2.1)
robotframework-selenium2library (1.8.0)
robotframework-sshlibrary (2.1.2)
selenium (3.4.3)

screen shot 2017-07-06 at 10 25 51 am

screen shot 2017-07-06 at 10 39 25 am

aaltat 2017-10-9
9

我没有什么好的建议要给, 因为我不知道这个问题的解决方案。我也不能重现这个问题。

因为屏幕截图是真正的薄包装上的硒, 我不认为这是一个 Selenium2Library 的问题。为了证明这个假设, 你能写出小的 Python 脚本, 从硒中调用相同的方法, 而不是 Selenium2Library 在屏幕截图时所做的吗?如果你不能写, 我可以为你写。然后, 您可以在您的环境中运行该脚本, 我们可以看到结果。

这可能是一个好主意, 也问从用户组有其他人有同样的问题, 他们是如何解决的问题。

原文:

I don't have any good advice to give, because I don't know a solution for this problem. Also I am not able to reproduce the problem.

Because the screen capture is really thin wrapper on top of the selenium, I don't think this is a Selenium2Library issue. To prove that assumption, are you able to write small Python script that call the same methods from selenium than the Selenium2Library would do when taking screen shot? If you are not able to write it, I can write it for you. Then you can run the script in your environment and we can see the results.

It might be good idea to also ask from the user group have someone else had the same problem and how they have solved the problem.

iradovanovic 2017-10-9
10

@willmiraglia你更新了詹金斯的东西吗?

你可能试过 FF 吗?

现在, 我得到一个想法, 尝试与旧的 chrome 版本。

原文:

@willmiraglia Did you update anything in/from Jenkins ?

Did you maybe try FF ?

Now, i'm getting an idea to try with an older chrome version.

willmiraglia 2017-10-9
11

@aaltat -这是一个好主意。如果你能给我那个剧本我可以试一下吗?
@iradovanovic 我还没能通过詹金斯的无头来得到 FF 的运行。但我正在努力我的想法是, 这也是一个 chrome 更新的问题, 也许, 但安装旧的 chrome 版本也可能是一个痛苦。我会调查的

原文:

@aaltat - That's a good idea. If you could give me that script then I could try it?
@iradovanovic I've not been able to get FF running yet via Jenkins headless. But I'm working on it. My thinking is this is also a chrome update problem perhaps, but installing older chrome versions can be a pain too. I'll look into it.

iradovanovic 2017-10-9
12

因此, chrome 是一个问题, 或者只是它们不兼容。安装了较旧版本的 chrome (48) 和旧的 chromedriver 后, 一切都恢复正常了。

原文:

So, the chrome is a problem or just they are not compatible. After installing an older version of chrome (48) and an older chromedriver, everything is working again.

aaltat 2017-10-9
13

下面是代码段:

from selenium import webdriver

driver = webdriver.Chrome()
driver.get("http://robotframework.org/")
assert "Robot" in driver.title
driver.save_screenshot('/path/to/robot.png')
driver.close()

把它放在一个 script.py 文件, 并从詹金斯运行。如果它产生同样的结果, 提出一个问题, 以硒方面。

原文:

Here is code snippet:

from selenium import webdriver

driver = webdriver.Chrome()
driver.get("http://robotframework.org/")
assert "Robot" in driver.title
driver.save_screenshot('/path/to/robot.png')
driver.close()

Put it in a script.py file and run in from Jenkins. If it produces the same result, raise an issue to Selenium side.

glipautomationuser1 2017-10-9
14

@aaltat谢谢, 我会试试的。

原文:

@aaltat Thanks, I'll try that out.

glipautomationuser1 2017-10-9
15

@iradovanovic 非常有趣, 所以它必须是铬。这就可以解释为什么问题发生在夜间, 最有可能是在 chrome 更新之后。我会试着弄清楚如何降级铬和测试它。虽然48似乎很老, 我会尝试逐步降级, 直到它再次工作。

原文:

@iradovanovic Very Interesting, so it must be chrome. That would explain why the problem occurred over night, most likely after chrome updated. I'll try figure out how to downgrade chrome and test it too. Although 48 seems very old, I'll try downgrade incrementally until it works again.

aaltat 2017-10-9
16

这是否仍然是一个问题, 或者我们能否结束这个问题。如果我们能够结束这一问题, 那就很高兴地听到这个问题是如何解决的。

原文:

Is this still a problem or can we close the issue. If we can close the issue, it would be nice to hear how the problem was solved.

drumaster17 2017-10-9
17

@aaltat你解决问题了吗?因为我也面临着这个问题

原文:

@aaltat Did you solve the problem ? because I'm also facing the issue

aaltat 2017-10-9
18

不, 我无法重现问题, 因此无法修复它。

原文:

No, I am unable to reproduce the problem and therefore I am not able to fix it.

aaltat 2017-10-9
19

但你可以从上面几个帖子我的脚本。如果你得到相同的结果与硒的脚本, 那么问题是在硒。在这种情况下, 你需要报告的问题, 硒问题跟踪。

原文:

But you could my script from few posts above. If you get the same results with that Selenium script, then the problem is in Selenium. In that case you need to report that problem to the Selenium issue tracker.

iradovanovic 2017-10-9
20

Sry 的反应很迟我在度假:)

我们有一个解决方法, 使用固定版本的 chrome。58和禁用的 chrome 更新。使用最后的 chrome webdriver。也在其他我们的 VM 使用 win7 和/或 win10 的问题没有提出。只赢8.1。

原文:

Sry for the late response. I was on vacation. :)

We have a workaround with using fix version of chrome. 58 and disabled chrome update. Using last chrome webdriver. Also on other our VM where is used win7 and/or win10 the problem is not presented. Only Win 8.1.

aaltat 2017-10-9
21

因为 Selenium2Library 是硒的一层薄薄的包装纸, 这就像是一个硒的虫子。@iradovanovic请向硒方打开一个问题。

@drumaster17@glipautomationuser1您找到解决问题的方法了吗?

原文:

Because Selenium2Library is a thin wrapper on top of the Selenium, this definitely feels like a Selenium bug. @iradovanovic please open a issue to the Selenium side.

@drumaster17 and @glipautomationuser1 have you found a solution to your problem?

aaltat 2017-10-9
22

因为这看起来像是在硒方面的问题, 我正在关闭这个问题。

原文:

Because this looks like problem in Selenium side, I am closing the issue.

iradovanovic 2017-10-9
23
原文:
返回
发表文章
iradovanovic
文章数
1
评论数
7
注册排名
60778