I have a very simple Iron Python / Windows Form application. When the application starts it adds a selection of labels in an array (this is working from a CSV file)
#Create Label for each Site
for s in sites:
if lasty == 682:
lasty = 0
lastx = lastx + 125
sitename = str(s) #Convert Name into a String
elementname = sitename.replace(" ","") + "Label"
element = Label()
element.Name = elementname
element.Text = str(sitename)
element.Parent = self
element.Location = Point(lastx,lasty)
labels.append(element) #add each element to the list
lasty = lasty + 22
pass
This is working fine. I then have a definition which runs another loop and depending on the result I would like it to change the colour of the label. Let's say Red for fail, Green for OK, Yellow for warning.
However I cannot seem to link to these labels by the element name I gave them
For example I would think that SiteNameLabel.ForeColor = Color.Green would turn that label green. However this fails and halts the program.
Any ideas? Most probably a simple question but I can't find anything about this online.
Here is the error:
'ipyw64.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Cannot find or open the PDB file.
'ipyw64.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Program Files (x86)\IronPython 2.7\ipyw64.exe'. Cannot find or open the PDB file.
'ipyw64.exe' (CLR v4.0.30319: ipyw64.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.Dynamic\v4.0_1.1.1.21__7f709c5b713576e1\Microsoft.Dynamic.dll'. Cannot find or open the PDB file.
'ipyw64.exe' (CLR v4.0.30319: ipyw64.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'. Cannot find or open the PDB file.
'ipyw64.exe' (CLR v4.0.30319: ipyw64.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'. Cannot find or open the PDB file.
'ipyw64.exe' (CLR v4.0.30319: ipyw64.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.Scripting\v4.0_1.1.1.21__7f709c5b713576e1\Microsoft.Scripting.dll'. Cannot find or open the PDB file.
'ipyw64.exe' (CLR v4.0.30319: ipyw64.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'. Cannot find or open the PDB file.
'ipyw64.exe' (CLR v4.0.30319: ipyw64.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll'. Cannot find or open the PDB file.
'ipyw64.exe' (CLR v4.0.30319: ipyw64.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\IronPython\v4.0_2.7.6.3__7f709c5b713576e1\IronPython.dll'. Cannot find or open the PDB file.
'ipyw64.exe' (CLR v4.0.30319: ipyw64.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\IronPython.Modules\v4.0_2.7.6.3__7f709c5b713576e1\IronPython.Modules.dll'. Cannot find or open the PDB file.
'ipyw64.exe' (CLR v4.0.30319: ipyw64.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Numerics\v4.0_4.0.0.0__b77a5c561934e089\System.Numerics.dll'. Cannot find or open the PDB file.
'ipyw64.exe' (CLR v4.0.30319: ipyw64.exe): Loaded 'C:\Program Files (x86)\IronPython 2.7\DLLs\IronPython.SQLite.dll'. Cannot find or open the PDB file.
'ipyw64.exe' (CLR v4.0.30319: ipyw64.exe): Loaded 'C:\Program Files (x86)\IronPython 2.7\DLLs\IronPython.Wpf.dll'. Cannot find or open the PDB file.
Exception thrown: 'IronPython.Runtime.Exceptions.ImportException' in IronPython.Modules.dll
Exception thrown: 'System.Reflection.TargetInvocationException' in mscorlib.dll
Exception thrown: 'IronPython.Runtime.Exceptions.ImportException' in Microsoft.Dynamic.dll
Exception thrown: 'IronPython.Runtime.Exceptions.ImportException' in Microsoft.Dynamic.dll
'ipyw64.exe' (CLR v4.0.30319: ipyw64.exe): Loaded 'Anonymously Hosted DynamicMethods Assembly'.
'ipyw64.exe' (CLR v4.0.30319: ipyw64.exe): Loaded 'Snippets.scripting'.
Exception thrown: 'IronPython.Runtime.Exceptions.ImportException' in IronPython.dll
Exception thrown: 'IronPython.Runtime.Exceptions.ImportException' in IronPython.dll
Exception thrown: 'IronPython.Runtime.Exceptions.ImportException' in IronPython.Modules.dll
Exception thrown: 'System.Reflection.TargetInvocationException' in mscorlib.dll
Exception thrown: 'IronPython.Runtime.Exceptions.ImportException' in Microsoft.Dynamic.dll
Exception thrown: 'IronPython.Runtime.Exceptions.ImportException' in Microsoft.Dynamic.dll
Exception thrown: 'IronPython.Runtime.Exceptions.ImportException' in IronPython.Modules.dll
Exception thrown: 'System.Reflection.TargetInvocationException' in mscorlib.dll
Exception thrown: 'IronPython.Runtime.Exceptions.ImportException' in Microsoft.Dynamic.dll
Exception thrown: 'IronPython.Runtime.Exceptions.ImportException' in Microsoft.Dynamic.dll
Exception thrown: 'IronPython.Runtime.Exceptions.ImportException' in IronPython.Modules.dll
Exception thrown: 'System.Reflection.TargetInvocationException' in mscorlib.dll
Exception thrown: 'IronPython.Runtime.Exceptions.ImportException' in Microsoft.Dynamic.dll
Exception thrown: 'IronPython.Runtime.Exceptions.ImportException' in Microsoft.Dynamic.dll
Exception thrown: 'IronPython.Runtime.Exceptions.ImportException' in IronPython.Modules.dll
Exception thrown: 'System.Reflection.TargetInvocationException' in mscorlib.dll
Exception thrown: 'IronPython.Runtime.Exceptions.ImportException' in Microsoft.Dynamic.dll
Exception thrown: 'IronPython.Runtime.Exceptions.ImportException' in Microsoft.Dynamic.dll
Exception thrown: 'IronPython.Runtime.Exceptions.ImportException' in IronPython.Modules.dll
Exception thrown: 'System.Reflection.TargetInvocationException' in mscorlib.dll
Exception thrown: 'IronPython.Runtime.Exceptions.ImportException' in Microsoft.Dynamic.dll
Exception thrown: 'IronPython.Runtime.Exceptions.ImportException' in Microsoft.Dynamic.dll
'ipyw64.exe' (CLR v4.0.30319: ipyw64.exe): Loaded 'Snippets.debug.scripting'.
'ipyw64.exe' (CLR v4.0.30319: ipyw64.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_64\ISymWrapper\v4.0_4.0.0.0__b03f5f7f11d50a3a\ISymWrapper.dll'. Cannot find or open the PDB file.
Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll
Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll
'ipyw64.exe' (CLR v4.0.30319: ipyw64.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll'. Cannot find or open the PDB file.
Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll
Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll
'ipyw64.exe' (CLR v4.0.30319: ipyw64.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0__b77a5c561934e089\System.Windows.Forms.dll'. Cannot find or open the PDB file.
'ipyw64.exe' (CLR v4.0.30319: ipyw64.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Accessibility\v4.0_4.0.0.0__b03f5f7f11d50a3a\Accessibility.dll'. Cannot find or open the PDB file.
Exception thrown: 'IronPython.Runtime.UnboundNameException' in IronPython.dll
Exception thrown: 'IronPython.Runtime.UnboundNameException' in Snippets.debug.scripting
Exception thrown: 'IronPython.Runtime.UnboundNameException' in Microsoft.Dynamic.dll
Exception thrown: 'IronPython.Runtime.UnboundNameException' in Snippets.debug.scripting
Exception thrown: 'IronPython.Runtime.UnboundNameException' in Snippets.debug.scripting
The program '[9416] ipyw64.exe' has exited with code 1 (0x1).
You cannot use SiteNameLabel as object reference. You must obtain reference to Label from Controls collection of your form. See following code:
import clr
clr.AddReference('System.Drawing')
clr.AddReference('System.Windows.Forms')
from System.Drawing import *
from System.Windows.Forms import *
class MyForm(Form):
def __init__(self):
myLabel = Label()
myLabel.Location = Point(10, 10)
myLabel.Text = "EXAMPLE LABEL"
myLabel.Name = "myLabel"
self.Controls.Add(myLabel)
# later you can find label by name this way:
self.Controls["myLabel"].ForeColor = Color.Green
Application.EnableVisualStyles()
Application.SetCompatibleTextRenderingDefault(False)
form = MyForm()
Application.Run(form)
Note: when you use WinForms designer (in C# project example), it generates form members with control names, so you can access them as you tried. But this is only applicable to controls added at design time.
Related
I have a asp.net 4.7.1 project (upgraded to 4.7.1 during last 6-7 years) and I' not able to connect/call any method in Azure Searchc from within that project. I'm getting a RequestFailedException (Complete log at end)
Unfortunatly can I not reproduce in new Console app, new Asp.net 4.7.1 project!
I'm running all types of projects on same machine in same Visual Studio 2022.
I'm calling the Search service with the exact same code and same version of Nuget (11.3.0). (I have tried earlier versions as well 11.1.1, but same error).
I'm using the same service/index and key (Currently just a free service, but doesn't make any different if I run against other)
My testcode is:
var searchIndexClient = new SearchIndexClient(new
Uri($"https://sfsearchtest.search.windows.net"),
new AzureKeyCredential("70C978F2751C051E0BF156B0....."),
options);
noIndexes = searchIndexClient.GetIndexes().Count();
(I've obfuscated the key here)
It does not matter if I try callanothr method then "GetIndexes". Same error.
Note I have set MaxRetries = 0; But more retries gives same error so I have turned down to 0 retries.
Help really appreciated after a couple of days frustration/testing. And please do not ask me to update project to .Netcore ;-)
I have made a file compare between the ddls for "my project" compared to a newly created 4.7.1 project and they are exactly the same files.
Here is an error log (from AzureEventSourceListener.CreateConsoleLogger and
AzureEventSourceListener.CreateTraceLogger).
Azure-Core: [Informational] Request [916938f7-cc37-483b-a134-33ca2c69d22b] GET https://sfsearchtest.search.windows.net/indexes?$select=*&api-version=2020-06-30
Accept:application/json; odata.metadata=minimal
api-key:REDACTED
x-ms-client-request-id:916938f7-cc37-483b-a134-33ca2c69d22b
x-ms-return-client-request-id:true
User-Agent:azsdk-net-Search.Documents/11.3.0 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.19044 )
client assembly: Azure.Search.Documents
Azure-Core: [Informational] Request [916938f7-cc37-483b-a134-33ca2c69d22b] GET https://sfsearchtest.search.windows.net/indexes?$select=*&api-version=2020-06-30
Accept:application/json; odata.metadata=minimal
api-key: REDACTED
x-ms-client-request-id:916938f7-cc37-483b-a134-33ca2c69d22b
x-ms-return-client-request-id:true
User-Agent:azsdk-net-Search.Documents/11.3.0 (.NET Framework 4.8.4420.0; Microsoft Windows 10.0.19044 )
client assembly: Azure.Search.Documents
Exception thrown: 'System.Net.Sockets.SocketException' in System.dll
Exception thrown: 'System.IO.IOException' in System.dll
Exception thrown: 'System.IO.IOException' in System.dll
Exception thrown: 'System.IO.IOException' in System.dll
Exception thrown: 'System.IO.IOException' in System.dll
Exception thrown: 'System.IO.IOException' in System.dll
Exception thrown: 'System.ObjectDisposedException' in System.dll
Exception thrown: 'System.Net.Sockets.SocketException' in System.dll
Exception thrown: 'System.IO.IOException' in System.dll
Exception thrown: 'System.IO.IOException' in System.dll
Exception thrown: 'System.IO.IOException' in System.dll
Exception thrown: 'System.IO.IOException' in System.dll
Exception thrown: 'System.IO.IOException' in System.dll
Exception thrown: 'System.ObjectDisposedException' in System.dll
Exception thrown: 'System.Net.WebException' in System.dll
Exception thrown: 'System.Net.WebException' in System.dll
Exception thrown: 'Azure.RequestFailedException' in Azure.Core.dll
Exception thrown: 'Azure.RequestFailedException' in mscorlib.dll
Exception thrown: 'Azure.RequestFailedException' in mscorlib.dll
Azure-Core: [Informational] Request [916938f7-cc37-483b-a134-33ca2c69d22b] exception Azure.RequestFailedException: The underlying connection was closed: An unexpected error occurred on a send.
at Azure.Core.Pipeline.HttpWebRequestTransport.<ProcessInternal>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Azure.Core.Pipeline.HttpWebRequestTransport.Process(HttpMessage message)
at Azure.Core.Pipeline.HttpPipelinePolicy.ProcessNext(HttpMessage message, ReadOnlyMemory`1 pipeline)
at Azure.Core.Pipeline.RequestActivityPolicy.ProcessNextAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
at Azure.Core.Pipeline.RequestActivityPolicy.Process(HttpMessage message, ReadOnlyMemory`1 pipeline)
at Azure.Core.Pipeline.HttpPipelinePolicy.ProcessNext(HttpMessage message, ReadOnlyMemory`1 pipeline)
at Azure.Core.Pipeline.ResponseBodyPolicy.<ProcessAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Azure.Core.Pipeline.ResponseBodyPolicy.Process(HttpMessage message, ReadOnlyMemory`1 pipeline)
at Azure.Core.Pipeline.HttpPipelinePolicy.ProcessNext(HttpMessage message, ReadOnlyMemory`1 pipeline)
at Azure.Core.Pipeline.LoggingPolicy.<ProcessAsync>d__9.MoveNext()
Azure-Core: [Informational] Request [916938f7-cc37-483b-a134-33ca2c69d22b] exception Azure.RequestFailedException: The underlying connection was closed: An unexpected error occurred on a send.
at Azure.Core.Pipeline.HttpWebRequestTransport.<ProcessInternal>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Azure.Core.Pipeline.HttpWebRequestTransport.Process(HttpMessage message)
at Azure.Core.Pipeline.HttpPipelinePolicy.ProcessNext(HttpMessage message, ReadOnlyMemory`1 pipeline)
at Azure.Core.Pipeline.RequestActivityPolicy.ProcessNextAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
at Azure.Core.Pipeline.RequestActivityPolicy.Process(HttpMessage message, ReadOnlyMemory`1 pipeline)
at Azure.Core.Pipeline.HttpPipelinePolicy.ProcessNext(HttpMessage message, ReadOnlyMemory`1 pipeline)
at Azure.Core.Pipeline.ResponseBodyPolicy.<ProcessAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Azure.Core.Pipeline.ResponseBodyPolicy.Process(HttpMessage message, ReadOnlyMemory`1 pipeline)
at Azure.Core.Pipeline.HttpPipelinePolicy.ProcessNext(HttpMessage message, ReadOnlyMemory`1 pipeline)
at Azure.Core.Pipeline.LoggingPolicy.<ProcessAsync>d__9.MoveNext()
Exception thrown: 'Azure.RequestFailedException' in Azure.Core.dll
Exception thrown: 'Azure.RequestFailedException' in mscorlib.dll
Exception thrown: 'Azure.RequestFailedException' in mscorlib.dll
Exception thrown: 'Azure.RequestFailedException' in mscorlib.dll
Exception thrown: 'Azure.RequestFailedException' in Azure.Search.Documents.dll
Ok. I managed to solve it. Short answer for now:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls12;
The Tls have caused problems before. Not sure why my old project causes problems with this (could not find anything about tls). Luckely this worked :)
Browser: Firefox 50 version
Selenium Jar files : 3.0.1 jar
OS: Windows 7 enterprise 64 bit
While executing the scripts by right clicking on the xml file "Run as testNG suite" the browser opens but immediately the error is displayed in the console.
Can any one please guide me do i need to downgrade the browser if so what would be the supporting version for selenium 3 version.
Error Log:
[TestNG] Running:
C:\Users\raghuveer.amajala\AppData\Local\Temp\testng-eclipse-1646049448\testng-customsuite.xml
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
true,"v":"1.0","st":1478328645000}},"winreg-app-user":{"ocplugin#webex.com":{"d":"C:\\Program Files (x86)\\WebEx\\Productivity Tools","e":false,"v":"2.0","st":1485264359732,"mt":1463471846535}},"app-global":{"{972ce4c6-7e08-4474-a285-3208198ce6fd}":{"d":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\extensions\\{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi","e":true,"v":"50.0","st":1478328645000}},"winreg-app-global":{"{D19CA586-DD6C-4a0a-96F8-14644F340D60}":{"d":"C:\\Program Files (x86)\\Common Files\\McAfee\\SystemCore","e":false,"v":"15.4.0","st":1477288713580,"mt":1476678768866}}}
1485322859314 addons.xpi DEBUG No changes found
1485322859325 addons.xpi DEBUG Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\aushelper#mozilla.org.xpi
1485322859326 addons.xpi DEBUG Loading bootstrap scope from C:\Program Files (x86)\Mozilla Firefox\browser\features\aushelper#mozilla.org.xpi
1485322859331 addons.xpi DEBUG Calling bootstrap method startup on aushelper#mozilla.org version 1.0
1485322859333 addons.xpi DEBUG Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\e10srollout#mozilla.org.xpi
1485322859334 addons.xpi DEBUG Loading bootstrap scope from C:\Program Files (x86)\Mozilla Firefox\browser\features\e10srollout#mozilla.org.xpi
1485322859343 addons.xpi DEBUG Calling bootstrap method startup on e10srollout#mozilla.org version 1.5
1485322859344 addons.xpi DEBUG Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\firefox#getpocket.com.xpi
1485322859345 addons.xpi DEBUG Loading bootstrap scope from C:\Program Files (x86)\Mozilla Firefox\browser\features\firefox#getpocket.com.xpi
1485322859349 addons.xpi DEBUG Calling bootstrap method startup on firefox#getpocket.com version 1.0.5
1485322859360 addons.xpi-utils DEBUG Starting async load of XPI database C:\Users\RAGHUV~1.AMA\AppData\Local\Temp\anonymous8881786919455687854webdriver-profile\extensions.json
1485322859362 addons.xpi DEBUG Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\webcompat#mozilla.org.xpi
1485322859362 addons.xpi DEBUG Loading bootstrap scope from C:\Program Files (x86)\Mozilla Firefox\browser\features\webcompat#mozilla.org.xpi
1485322859365 addons.xpi DEBUG Calling bootstrap method startup on webcompat#mozilla.org version 1.0
1485322859367 addons.manager DEBUG Registering shutdown blocker for XPIProvider
1485322859367 addons.manager DEBUG Provider finished startup: XPIProvider
1485322859367 addons.manager DEBUG Starting provider: LightweightThemeManager
1485322859367 addons.manager DEBUG Registering shutdown blocker for LightweightThemeManager
1485322859368 addons.manager DEBUG Provider finished startup: LightweightThemeManager
1485322859368 addons.manager DEBUG Starting provider: GMPProvider
1485322859386 addons.manager DEBUG Registering shutdown blocker for GMPProvider
1485322859386 addons.manager DEBUG Provider finished startup: GMPProvider
1485322859386 addons.manager DEBUG Starting provider: PluginProvider
1485322859387 addons.manager DEBUG Registering shutdown blocker for PluginProvider
1485322859387 addons.manager DEBUG Provider finished startup: PluginProvider
1485322859387 addons.manager DEBUG Completed startup sequence
1485322859726 addons.xpi-utils DEBUG Async JSON file read took 0 MS
1485322859726 addons.xpi-utils DEBUG Finished async read of XPI database, parsing...
1485322859728 addons.xpi-utils DEBUG Successfully read XPI database
1485322859739 addons.manager DEBUG Starting provider: <unnamed-provider>
1485322859739 addons.manager DEBUG Registering shutdown blocker for <unnamed-provider>
1485322859740 addons.manager DEBUG Provider finished startup: <unnamed-provider>
*** Blocklist::_loadBlocklistFromFile: blocklist is disabled
1485322859848 addons.manager DEBUG Starting provider: PreviousExperimentProvider
1485322859849 addons.manager DEBUG Registering shutdown blocker for PreviousExperimentProvider
1485322859849 addons.manager DEBUG Provider finished startup: PreviousExperimentProvider
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:118)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:246)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:114)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:193)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:182)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:95)
at Registration.Registration_webdriver.SetUp(Registration_webdriver.java:88)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:175)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:107)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:236)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:81)`
Below is the setup() method this is my before class.
#BeforeClass
public void SetUp()throws Exception
{
//System.setProperty("webdriver.ie.driver","D:\\jar-files\\IEDriverServer_Win32_2.39.0\\IEDriverServer.exe");
//driver = new InternetExplorerDriver();
//String firefoxlocation=System.getenv("ProgramFiles(X86)")+"\\Mozilla Firefox\\firefox.exe";
//System.setProperty("webdriver.firefox.bin", firefoxlocation);
System.setProperty("webdriver.gecko.driver", driverPath+"geckodriver.exe");
driver = new FirefoxDriver();
driver.get(partnerportalurl);
driver.manage().window().maximize();
String title=driver.getTitle();
System.out.println(title);
}
selenium tries to use the firefox which is currently installed on your machine. This one is probably newer than the one supported in your selenium version. To fix this you could download a compatible firefox version and pass it in the DesiredCapabilities. It is always helpful to read the selenium changelog for the supported firefox versions.
DesiredCapabilities capabilities = new DesiredCapabilities();
// linux
capabilities.setCapability(FirefoxDriver.BINARY, "/path/to/your_firefox/firefox-bin");
// win
capabilities.setCapability(FirefoxDriver.BINARY, "C:\\path\\to\\your_firefox\\firefox.exe");
WebDriver webdriver = new FirefoxDriver(capabilities);
Just downgrade to firefox 47.0.1 and disable updates. I come accross this issue any time firefox does update to version 50. (issue tested on selenium 2.x and 3.x).
Please take a look here
SEVERE: Servlet.service() for servlet [jsp] in context with path [/MAT] threw exception [java.lang.IllegalStateException: Exception occurred when flushing data] with root cause
java.io.IOException: Stream closed
My protractor test fails on firefox. I have added following capability in conf file:
capabilities: {
'browserName': 'firefox'
}
After running, following error is displayed. I am using Ubuntu 14 if that helps.
Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
ERROR - Unable to start a WebDriver session.
/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/error.js:113
var template = new Error(this.message);
^
UnknownError: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
4723000,"mt":1425651386000}},"app-system-share":{"ubufox#ubuntu.com":{"d":"/usr/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/ubufox#ubuntu.com","e":false,"v":"3.0","st":1424796630000,"mt":1420839872000},"{2e1445b0-2682-11e1-bfc2-0800200c9a66}":{"d":"/usr/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/{2e1445b0-2682-11e1-bfc2-0800200c9a66}","e":false,"v":"2014.08.06.beta","st":1424796641000,"mt":1407283796000},"webapps-team#lists.launchpad.net":{"d":"/usr/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/webapps-team#lists.launchpad.net","e":false,"v":"3.0.2","st":1406067316000,"mt":1397665356000}},"app-system-local":{"online-accounts#lists.launchpad.net":{"d":"/usr/lib/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/online-accounts#lists.launchpad.net","e":false,"v":"0.5","st":1406067316000,"mt":1390969548000}}}
1426580297707 addons.xpi DEBUG getModTime: Recursive scan of fxdriver#googlecode.com
1426580297709 addons.xpi DEBUG getModTime: Recursive scan of langpack-en-ZA#firefox.mozilla.org
1426580297709 addons.xpi DEBUG getModTime: Recursive scan of langpack-en-GB#firefox.mozilla.org
1426580297709 addons.xpi DEBUG getModTime: Recursive scan of {972ce4c6-7e08-4474-a285-3208198ce6fd}
1426580297710 addons.xpi DEBUG getInstallState changed: false, state: {"app-profile":{"fxdriver#googlecode.com":{"d":"/tmp/anonymous6681130175732276890webdriver-profile/extensions/fxdriver#googlecode.com","e":true,"v":"2.44.0","st":1426580296000,"mt":1426580296000}},"app-global":{"langpack-en-ZA#firefox.mozilla.org":{"d":"/usr/lib/firefox/browser/extensions/langpack-en-ZA#firefox.mozilla.org.xpi","e":true,"v":"36.0.1","st":1425652027000},"langpack-en-GB#firefox.mozilla.org":{"d":"/usr/lib/firefox/browser/extensions/langpack-en-GB#firefox.mozilla.org.xpi","e":true,"v":"36.0.1","st":1425652027000},"{972ce4c6-7e08-4474-a285-3208198ce6fd}":{"d":"/usr/lib/firefox/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}","e":true,"v":"36.0.1","st":1425974723000,"mt":1425651386000}},"app-system-share":{"ubufox#ubuntu.com":{"d":"/usr/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/ubufox#ubuntu.com","e":false,"v":"3.0","st":1424796630000,"mt":1420839872000},"{2e1445b0-2682-11e1-bfc2-0800200c9a66}":{"d":"/usr/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/{2e1445b0-2682-11e1-bfc2-0800200c9a66}","e":false,"v":"2014.08.06.beta","st":1424796641000,"mt":1407283796000},"webapps-team#lists.launchpad.net":{"d":"/usr/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/webapps-team#lists.launchpad.net","e":false,"v":"3.0.2","st":1406067316000,"mt":1397665356000}},"app-system-local":{"online-accounts#lists.launchpad.net":{"d":"/usr/lib/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/online-accounts#lists.launchpad.net","e":false,"v":"0.5","st":1406067316000,"mt":1390969548000}}}
1426580297711 addons.xpi DEBUG No changes found
1426580297714 addons.xpi DEBUG Registering manifest for /usr/lib/firefox/browser/extensions/langpack-en-ZA#firefox.mozilla.org.xpi
1426580297715 addons.xpi DEBUG Registering manifest for /usr/lib/firefox/browser/extensions/langpack-en-GB#firefox.mozilla.org.xpi
1426580297715 addons.manager DEBUG Registering shutdown blocker for XPIProvider
1426580297716 addons.manager DEBUG Registering shutdown blocker for LightweightThemeManager
1426580297717 addons.manager DEBUG Registering shutdown blocker for OpenH264Provider
1426580297717 addons.manager DEBUG Registering shutdown blocker for PluginProvider
JavaScript error: file:///tmp/anonymous6681130175732276890webdriver-profile/extensions/fxdriver#googlecode.com/components/driver-component.js, line 11487: TypeError: this.server_ is undefined
JavaScript error: chrome://fxdriver/content/server.js, line 38: NS_ERROR_XPC_CI_RETURNED_FAILURE: Component returned failure code: 0x80570015 (NS_ERROR_XPC_CI_RETURNED_FAILURE) [nsIJSCID.createInstance]
*** Blocklist::_preloadBlocklistFile: blocklist is disabled
1426580298537 addons.manager DEBUG Registering shutdown blocker for <unnamed-provider>
at new bot.Error (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/error.js:113:18)
at Object.bot.response.checkResponse (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/response.js:106:9)
at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:152:24
at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1582:15
at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1654:20)
at notify (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:465:12)
at notifyAll (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:442:7)
at resolve (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:420:7)
at fulfill (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:535:5)
at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1582:15
==== async task ====
WebDriver.createSession()
at Function.webdriver.WebDriver.acquireSession_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:149:22)
at Function.webdriver.WebDriver.createSession (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:123:30)
at Builder.build (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/builder.js:294:22)
at DriverProvider.getNewDriver (/usr/local/lib/node_modules/protractor/lib/driverProviders/driverProvider.js:38:7)
at Runner.createBrowser (/usr/local/lib/node_modules/protractor/lib/runner.js:180:37)
at /usr/local/lib/node_modules/protractor/lib/runner.js:246:21
at _fulfilled (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:797:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:826:30)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:759:13)
[launcher] Process exited with error code 1
aman#aman-Latitude-E5540:~/work/protractor/social_publish$ protractor conf.js
Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
ERROR - Unable to start a WebDriver session.
/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/error.js:113
var template = new Error(this.message);
^
UnknownError: org/openqa/selenium/browserlaunchers/Proxies
at new bot.Error (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/error.js:113:18)
at Object.bot.response.checkResponse (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/response.js:106:9)
at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:152:24
at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1582:15
at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1654:20)
at notify (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:465:12)
at notifyAll (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:442:7)
at resolve (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:420:7)
at fulfill (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:535:5)
at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1582:15
==== async task ====
WebDriver.createSession()
at Function.webdriver.WebDriver.acquireSession_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:149:22)
at Function.webdriver.WebDriver.createSession (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:123:30)
at Builder.build (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/builder.js:294:22)
at DriverProvider.getNewDriver (/usr/local/lib/node_modules/protractor/lib/driverProviders/driverProvider.js:38:7)
at Runner.createBrowser (/usr/local/lib/node_modules/protractor/lib/runner.js:180:37)
at /usr/local/lib/node_modules/protractor/lib/runner.js:246:21
at _fulfilled (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:797:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:826:30)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:759:13)
[launcher] Process exited with error code 1
It looks like there is an issue with firefox 35/36 https://github.com/angular/protractor/issues/1734.
Workaround:
Download firefox 34 from here https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/34.0/linux-x86_64/en-US/. After downloading, inside conf file do following:
capabilities: {
'browserName': 'firefox',
firefox_binary : "path_for_folder_downloaded/firefox/firefox", //firefox executable
}
Using Worklight 6.2
I deployed the application into Worklight Server
I open the Worklight Console and click on 'Preview'
I could not see the Mobile Browser Simulator; the browser only displays the index.html page of the application without the Mobile Browser Simulator.
There is stacktrace in the Worklight Console.
I am pasting a portion of the stacktrace below.
-
[ERROR ] SRVE0777E: Exception thrown by application class 'sun.nio.ch.FileDispatcherImpl.writev0:-2'
java.io.IOException: Broken pipe
at sun.nio.ch.FileDispatcherImpl.writev0(Native Method)
at sun.nio.ch.SocketDispatcher.writev(SocketDispatcher.java:51)
at sun.nio.ch.IOUtil.write(IOUtil.java:148)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:524)
at java.nio.channels.SocketChannel.write(SocketChannel.java:493)
at com.ibm.ws.tcpchannel.internal.NioSocketIOChannel.write(NioSocketIOChannel.java:206)
at [internal classes]
at com.worklight.gadgets.serving.PreviewServlet.handleAsLooseWorkspaceFile(PreviewServlet.java:206)
at com.worklight.gadgets.serving.PreviewServlet.respondToRequest(PreviewServlet.java:115)
at com.worklight.gadgets.serving.WebServingServletBase.doGetOrPost(WebServingServletBase.java:87)
at com.worklight.gadgets.serving.WebServingServletBase.doGet(WebServingServletBase.java:71)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:575)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1239)
at [internal classes]
at com.worklight.core.auth.impl.AuthenticationFilter$1.execute(AuthenticationFilter.java:205)
at com.worklight.core.auth.impl.AuthenticationServiceBean.accessResource(AuthenticationServiceBean.java:76)
at com.worklight.core.auth.impl.AuthenticationFilter.doFilter(AuthenticationFilter.java:209)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:194)
at [internal classes]
[ERROR ] SRVE0777E: Exception thrown by application class 'sun.nio.ch.FileDispatcherImpl.writev0:-2'
java.io.IOException: Broken pipe
at sun.nio.ch.FileDispatcherImpl.writev0(Native Method)
at sun.nio.ch.SocketDispatcher.writev(SocketDispatcher.java:51)
at sun.nio.ch.IOUtil.write(IOUtil.java:148)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:524)
at java.nio.channels.SocketChannel.write(SocketChannel.java:493)
at com.ibm.ws.tcpchannel.internal.NioSocketIOChannel.write(NioSocketIOChannel.java:206)
at [internal classes]
at com.worklight.gadgets.serving.PreviewServlet.handleAsLooseWorkspaceFile(PreviewServlet.java:206)
at com.worklight.gadgets.serving.PreviewServlet.respondToRequest(PreviewServlet.java:115)
at com.worklight.gadgets.serving.WebServingServletBase.doGetOrPost(WebServingServletBase.java:87)
at com.worklight.gadgets.serving.WebServingServletBase.doGet(WebServingServletBase.java:71)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:575)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1239)
at [internal classes]
at com.worklight.core.auth.impl.AuthenticationFilter$1.execute(AuthenticationFilter.java:205)
at com.worklight.core.auth.impl.AuthenticationServiceBean.accessResource(AuthenticationServiceBean.java:76)
at com.worklight.core.auth.impl.AuthenticationFilter.doFilter(AuthenticationFilter.java:209)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:194)
at [internal classes]
[ERROR ] SRVE0777E: Exception thrown by application class 'sun.nio.ch.FileDispatcherImpl.writev0:-2'
java.io.IOException: Broken pipe
at sun.nio.ch.FileDispatcherImpl.writev0(Native Method)
at sun.nio.ch.SocketDispatcher.writev(SocketDispatcher.java:51)
at sun.nio.ch.IOUtil.write(IOUtil.java:148)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:524)
at java.nio.channels.SocketChannel.write(SocketChannel.java:493)
at com.ibm.ws.tcpchannel.internal.NioSocketIOChannel.write(NioSocketIOChannel.java:206)
at [internal classes]
at com.worklight.gadgets.serving.PreviewServlet.handleAsLooseWorkspaceFile(PreviewServlet.java:206)
at com.worklight.gadgets.serving.PreviewServlet.respondToRequest(PreviewServlet.java:115)
at com.worklight.gadgets.serving.WebServingServletBase.doGetOrPost(WebServingServletBase.java:87)
at com.worklight.gadgets.serving.WebServingServletBase.doGet(WebServingServletBase.java:71)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:575)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1239)
at [internal classes]
at com.worklight.core.auth.impl.AuthenticationFilter$1.execute(AuthenticationFilter.java:205)
at com.worklight.core.auth.impl.AuthenticationServiceBean.accessResource(AuthenticationServiceBean.java:76)
at com.worklight.core.auth.impl.AuthenticationFilter.doFilter(AuthenticationFilter.java:209)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:194)
at [internal classes]
[ERROR ] FWLSE0048E: Unhandled exception caught: java.io.IOException: Broken pipe
com.ibm.ws.webcontainer.webapp.WebAppErrorReport: java.io.IOException: Broken pipe
at com.ibm.ws.webcontainer.webapp.WebAppErrorReport.constructErrorReport(WebAppErrorReport.java:153)
at com.ibm.ws.webcontainer.webapp.WebAppErrorReport.constructErrorReport(WebAppErrorReport.java:194)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:830)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:461)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:127)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:88)
at com.worklight.core.auth.impl.AuthenticationFilter$1.execute(AuthenticationFilter.java:205)
at com.worklight.core.auth.impl.AuthenticationServiceBean.accessResource(AuthenticationServiceBean.java:76)
at com.worklight.core.auth.impl.AuthenticationFilter.doFilter(AuthenticationFilter.java:209)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:194)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:85)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:968)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1056)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4510)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.handleRequest(DynamicVirtualHost.java:282)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:954)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.run(DynamicVirtualHost.java:252)
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:584)
at com.ibm.ws.threading.internal.Worker.executeWork(Worker.java:439)
at com.ibm.ws.threading.internal.Worker.run(Worker.java:421)
at java.lang.Thread.run(Thread.java:745)
It is very possible that you have another instance of JVM running that are doing the same thing, perhaps you can kill the java process and try again.