Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: Cannot read property 'defaultView' of undefined [duplicate] - selenium-webdriver

I am trying to use Selenium for Python eith the Chrome webdriver to automate the download of a file.
My program works perfectly up to the last step (clicking on the 'download' button) at which point a dialog box is triggered with the text:
"An error has occured in 'site url': Uncaught TypeError: Cannot read property 'getColomnSet' of undefined41"
What does this error mean and what are the most probable causes?
For reference, here are the last few commands of my program:
try:
elem = wait.until(EC.presence_of_element_located((By.ID,'element_1_id')))
finally:
elem1 = driver.find_element_by_id('element_1_id')
elem2 = driver.find_element_by_id('element_2_id')
action = ActionChains(driver).move_to_element(elem1).move_to_element(elem2)
action.perform()
elem2.click()

This error message...
An error has occured in 'site url': Uncaught TypeError: Cannot read property 'getColomnSet' of undefined
...implies that your program was unable to read the property getColomnSet while trying to download the desired file.
Possibly, the main problem is the js involved to download the document is invoked before the client renders the HTML DOM completely.
The relevant HTML, a bit more of your previous lines of code and the error stack trace would have given us some more idea about what's going wrong.
Solution
You can induce some measures to wait till the complete DOM Tree is rendered following the discussion:
Generic funtion to check if page has completely loaded in Selenium
A couple of facts:
In your code trials I don't see you interacting with the element (By.ID,'element_1_id') so possibly you can remove the step of presence_of_element_located() for the element (By.ID,'element_1_id').
If you still require presence_of_element_located((By.ID,'element_1_id')) catch the exception and initiate required steps.
As you invoke move_to_element() over elem1 and elem2 and moving ahead invoke perform() you need to induce WebDriverWait with expected_conditions as element_to_be_clickable(locator)
tl;dr (references)
Cannot read property 'getContext' of null, using canvas
Uncaught TypeError: Cannot read property 'getContext' of undefined
Uncaught Error remote.js

Try the following - it works on Salesforce Lightning UI screens:
WebElement element = driver.findElement(By.id("your ID"));
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", element);

Related

Katalon : Unable to click on object after use switchTo and waitForElementClickable

I have problem with find element in my script. I use switchToframe and waitForElementClickable and a still have error
Unable to click on object 'Object Repository/1_2.Wniosek_o_OsFiz_v2/Page_Do wysyki i robocze - seap-testskgpl/label_Zaznacz lini' (Root cause: com.kms.katalon.core.exception.StepFailedException: Unable to click on object 'Object Repository/1_2.Wniosek_o_OsFiz_v2/Page_Do wysyki i robocze - seap-testskgpl/label_Zaznacz lini'
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:64)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:26)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.click(ClickKeyword.groovy:76)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.execute(ClickKeyword.groovy:43)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:72)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click(WebUiBuiltInKeywords.groovy:616)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$click$1.call(Unknown Source)
at 1_2.Wniosek_o_OsFiz_v2.run(1_2.Wniosek_o_OsFiz_v2:85)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:337)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1586510087999.run(TempTestCase1586510087999.groovy:23)
This is details for my element:
And this is my code (I still work in iframe, page reload. Element is in this same iframe):
WebUI.waitForElementClickable(findTestObject('Object Repository/1_2.Wniosek_o_OsFiz_v2/Page_Do wysyki i robocze - seap-testskgpl/label_Zaznacz lini'),
10)
WebUI.click(findTestObject('Object Repository/1_2.Wniosek_o_OsFiz_v2/Page_Do wysyki i robocze - seap-testskgpl/label_Zaznacz lini'))
Somebody can help me ?
The XPath for the link you are trying to get is generated by web-recorder. Those selectors tend to be flaky because they are dynamic (so, they won't be the same every time you run the tests). I suggest you learn how to get the XPath yourself using Google DevTools or similar.
In this particular case, change the value of Selected Locator from //div[#id='document0']/div[3]/label to //a[#title='Documenty do wysylki'].

How to add additional track in twilio-video?

After updating twilio-video JS SDK (from 1.x to 2.x) I have a problem in adding additional device.
This is example error message - ERROR TypeError: transceiver.sender.replaceTrack(...).then(...).finally is not a function.
If I disable this device i get new error message - ERROR Error: Uncaught (in promise): Error: The [LocalVideoTrack #5: 8da6e8e0-a9c1-473b-9916-484a17f61524] was unpublished.
And if I repeat enable device - is OK.
Below is example publishing track in share additional track method.
this.room
.localParticipant
.publishTrack(this.deviceTracks[type]);
this.deviceTrackShared[type] = true;
Below is example unpublishing track -
this.room
.localParticipant
.unpublishTrack(this.deviceTracks[type]);
this.deviceTrackShared[type] = false;
So, I fixed this issue. I lost a lot of time searching for errors in the code, but I just needed to update zone.js from 0.8.x to 0.9.x. Now it's working fine!

I have unknown error in console in my react application

What does it mean?
Error in event handler for (unknown):
TypeError: Cannot read property 'response' of undefined
at t.runtime.sendMessage.e (chrome-extension://mlomiejdfkolichcflejclcbmpeaniij/dist/content_script_bundle.js:1:22694)
Chrome extension with id mlomiejdfkolichcflejclcbmpeaniij seems to be ghostery. You probably should disable it for local development.

How to use ReactiveUI with WinForms

I have decided to learn ReactiveUI after seeing what can be done with it, but my enthusiasm has been broken at the first attempt to run a simple project. I have recreated the example from this article, using reactiveui-winforms.Net40 version 6.5.0 from NuGet. Everything compiles ok, but i get an exception during runtime at the following line
var OKCmdObs = this.WhenAny(vm => vm.EnteredText,
s => !string.IsNullOrWhiteSpace(s.Value));
System.InvalidOperationException occurred
HResult=-2146233079
Message=The current thread has no Dispatcher associated with it.
Source=System.Reactive.Windows.Threading
StackTrace:
at System.Reactive.Concurrency.DispatcherScheduler.get_Current()
at ReactiveUI.PlatformRegistrations.<>c.<Register>b__0_7() in C:\workspace\git-perso\ReactiveUI\ReactiveUI\Platform\Registrations.cs:line 75
InnerException:
Does anyone have any idea of what's happening ?
The mentioned article does not have the compiled project available for download, and i didn't find any complete "Hello-World" project for reactiveui-winforms.
My test project can be downloaded here.
In Visual Studio, if i Continue(F5), another exception occures :
System.NullReferenceException occurred
HResult=-2147467261
Message=Object reference not set to an instance of an object.
Source=ReactiveUI
StackTrace:
at ReactiveUI.IROObservableForProperty.<>c__DisplayClass1_0.<GetNotificationForProperty>b__6(IReactivePropertyChangedEventArgs`1 x) in C:\workspace\git-perso\ReactiveUI\ReactiveUI\IROObservableForProperty.cs:line 44
InnerException:
If i continue to hit F5 i get :
System.Exception was unhandled by user code
HResult=-2146233088
Message=An OnError occurred on an object (usually ObservableAsPropertyHelper) that would break a binding or command. To prevent this, Subscribe to the ThrownExceptions property of your objects
Source=ReactiveUI
This exception is caused because RxUI always tries to initialize for WPF, even though (because you're also using the winforms package) it'll override this setting with a Winforms-based scheduler right after.
It should be harmless though, as it's catched and ignored. You're probably hitting it within VS ?

find the element in the source html code for invalid login case in protractor

I'm trying to write a simple "failed login" test in protractor. The thing is, i can't point (don't know how), to the specific string in the source code.
I tried all kinds of things like: cssContainingText, to equal, get text and etc. (maybe it's ok, but i did that wrong).
The test:
describe('login to POC', function() {
it('should login to POC', function() {
browser.get('http://emeaherz-swaqal:8080/web-client/login.html#/login');
element(by.model('echos_username')).sendKeys('super1');
element(by.model('echos_password')).sendKeys('super');
element(by.id('loginButton')).click();
expect(by.id('action-messages')).getText('The following error(s) occurred:').isPresent()).toBe(true);
});
});
Please look on the source code.
I'm really need the suggestion here!
html source
the error i'm getting is:
#alecxe
1) login to POC should login to POC
Message:
NoSuchElementError: No element found using locator: By.cssSelector(".action-messages")
Stacktrace:
NoSuchElementError: No element found using locator: By.cssSelector(".action-messages")
==== async task ====
Asynchronous test function: it()
Error
at [object Object]. (/localfs/Poc/qapoc1/ECHOS-V2-POC/tests/fail_login.js:16:18)
Error
at [object Object]. (/localfs/Poc/qapoc1/ECHOS-V2-POC/tests/fail_login.js:6:3)
at Object. (/localfs/Poc/qapoc1/ECHOS-V2-POC/tests/fail_login.js:1:63)
Finished in 4.942 seconds
1 test, 1 assertion, 1 failure
You miss the element call and I think you can just expect the text of the error message. Replace:
expect(by.id('action-messages')).getText('The following error(s) occurred:').isPresent()).toBe(true);
with:
expect($('#action-messages ul li').getText()).toEqual("Sorry, your username ...");

Resources