I have created a script that logs into a website, but now I need help. Here is the main script that logs me in, pretty self explanatory.
WebBrowser1.Document.GetElementById("login").SetAttribute("value", txtUsername.Text)
WebBrowser1.Document.GetElementById("passwd").SetAttribute("value", txtPassword.Text)
WebBrowser1.Document.GetElementById("SI").InvokeMember("Click")
Now, what I am trying to do is make it tell me if I have used the right log in or not (the website i'm using is live.com). So obviously I'm going to need something that can read the page, and if it finds this "That Microsoft account doesn't exist. Enter a different email address or get a new account." or this "That password is incorrect. Be sure you're using the password for your Microsoft account." then it should say something along the lines of this in a message box: "Could not log in". But if it's successful it should read something else, and also redirect it to a page. Can anyone give me any references or tips on how to start this?
Use a browser's developer tool (for example, Firefox's Ctrl-Shift-I) to see the ID of the error message (in this case, "idTd_Tile_ErrorMsg_Login").
Then try WebBrowser1.Document.GetElementById("idTd_Tile_ErrorMsg_Login"). If that element's content is empty, there is no error message and login succeeded. Also, when you log in the page changes. So you can observe changes in the page URL, or see if the element (idTd_Tile_ErrorMsg_Login) can not be found.
Related
I am trying to automate web form data entry by using selenium VBA. We need to submit the forms on our organization SharePoint site, which requires us to log-in. I have already logged into the account. Please see the code below. Whenever I open the page (last step), there is a pop-up window asking me to enter the username and password again. I need to pass this step in order to get to the form that I want to enter all my information. I am not quite sure if this is an extra security that our IT team set up, but I could not inspect the page. I have included a screenshot here. I am hoping to inspect the pop-up window somehow so that I could use FindElementById. Thank you in advance for your reply.
obj.Start "chrome", ""
obj.Get "link"
obj.FindElementById("passwordInput").SendKeys ("password")
obj.FindElementById("submitButton").Submit
obj.FindElementById("idSIButton9").Submit
obj.FindElementByClass("reg-button").Click
obj.Wait ("1000")
obj.FindElementByXPath("//div[#id='slwp_ctl00_ctl41_g_f6ad5b95_2503_406f_ad81_eb5b3f59cad2']/div/div[3]/ul/li[10]/div/a").Click
I had a similar issue. However, in my case the dialog box was coming even before the login page was displayed.
The solution to the issue is given here
Maybe something similar will help for you. Please try following steps.
I am not sure of the syntax in VBA. But these steps should help you.
Get the current URL.
In java this can be done by using the getCurrentUrl() method of WebDriver interface.
Modify this current URL to include username and password.
The modified URL should be of in the following format:
http://username:password#example.com/
In java, this can be done by using the various methods of String class,
Submit the modified URL.
In java this can be done by using the get(String URL) method of WebDriver interface.
In the "G Suite Developer Hub", there is an option on the left column named "My Executions", where you can find out whether the code you developed executed successfully or not.
However, in some scenarios when you want to check out the failed reason, the log message can show as below:
Though it says "Please try again later" -- actually nothing changes after days.
In my experience, reaching the maximum computer time on the server can be one of the reason. Just wondering if there is any other reason can cause this error message?
The Chrome console window is full of warning messages that I like to hide.
Is it possible to hide the warning logs?
I only want to show my custom logs e.g. console.log('mymessage');
This is how the console windowbar looks like:
Just recently there was a Chrome update. Now filtering single message types is possible (Verbose, Info, Warnings, Errors)! (My Version: Version 60.0.3112.90)
When opening the console, instead of selecting a "filter level", you can now check or uncheck each message type.
As of Chrome version 78 (Dec 2019), in the "Console" tab, click on the "Default levels" pulldown, and uncheck the types of messages you don't want displayed.
At the top bar of the console log you can select what kind of messages should be shown.
All is selected by default. Select error to see only error.
You can press ctrl + click to select multiple message types.
First off: you can hide all warnings and show only console.log output if you are using Microsoft Edge. In the console, there are a couple of icons representing the different levels of log output you may be using - error, warning, and info. If you just want to hide warnings, you can simply toggle the warning icon to off.
Also, if you are on firefox, you can set the log to only display info, in which case the warnings will also be hidden.
Next, to elaborate on the other answer, and phrase what I said (above in my comment) in the form of an answer:
For chrome, you cannot toggle specific levels off individually (newer versions of Chrome). Instead, you have to set an overall verbosity level for the log. By using the strictest level (i.e. the level that displays the least), you can minimize console messages that are created by portions of code that you did not write. In this case, that is the error level.
If you are just trying to hide warning messages for testing purposes, you can, for the time being, switch over to only logging messages at the error level. In production, this is not good practice, as it doesn't let you differentiate between helpful info log messages or actual errors.
To log a message as an error, use:
console.error('mymessage');
Then, as mentioned above, you can change the Level of your console output to error, which will only show you error messages. It will ignore console.log as well as any warning messages.
Be sure to change your calls to console.error back to console.log when you are done with the development phase of your work, for any instances where you are calling console.error with some message that does not describe an error.
Now, if you are getting warnings due to something you are doing in your code, you may want to consider spending time trying to correct whatever is causing those warnings to appear. Warnings are generally well thought out, and are there to help you prevent issues in your code that you may not be aware of. Correcting any issues in your code would also cause the warning messages to go away.
NOTE: you cannot tell the console to only display messages you print out, even at the level of verbosity you set your console to. This is because the console would have no way of knowing which statements you are logging out, versus which statements code your webpage is running that was written by someone else is logging out. The steps mentioned in this answer as well as the other are workarounds that may improve your situation.
UPDATE: It seems like Chrome has reintroduced the ability to enable/disable different levels of console logging individually. Now, when clicking on log level, you can toggle whether certain log levels are enabled or disabled.
Under the console tab it is now possible to highlight the message type as a general filter. There is also a filter box right next to the eyeball. So if you put a unique flag in your console.log then it will show only your messages with this flag.
But in general. I think you want to click the 'Info' item as highlighted below to just obtain the console.log messages
There is a drop down next to filter, where can you select only things you require.
Note : ReactJS warnings are actually displayed in red as errors. So to remove them you need to uncheck errors too.
When I try to run my Windows Store app, it won't, and shows me this:
..."does not support the contract specified"? What contract? I'm not implementing any contract; I assume it means the Settings contract or some such, but I'm not doing any of those yet.
I went to the Help page suggested, and it says, in part, "To diagnose these errors
There are no sure ways to fix these errors. Use these techniques to diagnose the problem."
The first suggestion is:
Open Event Viewer (on the Windows Start menu, search for Event Viewer.) In Event Viewer, navigate in the tree to the Application and Services Log\Microsoft\Windows\Apps folder.
Filter the view to event Ids: 5900-6000
Examine the log and see what occurred.
Windows 8.1 only brings up web pages when I search for "Event Viewer"
Actually, I did write a utility to catch event logs, and I ran that. I found these:
***Type: Error
Source: Microsoft-Windows-Immersive-Shell
Time Generated: 11/27/2014 15:10:39
Message: Activation of app App.adaf78a74.a8c80.a4ff5.a99ca.a97636d548196_8wekyb3d8bbwe!Designer.App failed with error: -2144927148 See the Microsoft-Windows-TWinUI/Operational log for additional information.
Type: Error
Source: Microsoft-Windows-Immersive-Shell
Time Generated: 11/27/2014 15:20:08
Message: Activation of app axXAndSpace.Visits_qtyjefqf75sa6!App failed with error: -2144927148 See the Microsoft-Windows-TWinUI/Operational log for additional information.***
But where is "Microsoft-Windows-TWinUI/Operational log"?
The second suggestion on the Help page was:
Use the native debugger
Configure the project to run under a native debugger.
In Visual Studio, set the Debugger Type to Native Only on the Debug (Debugging in C++ and JavaScript) page of the property pages of the start-up project.
Look at the exceptions being thrown by looking at the output window. You might want to configure the debugger to stop when these exceptions are thrown.
I did that, but it gave me no more information than previously - nothing at all displays in the Output pane.
What could be the cause of this?
UPDATE
Just to update the progress:
Based on Iris Classon's suggestions, I went to Control Panel to see if my app was installed so that I could uninstall it, but it's not in that list.
If I search for the app by typing its name, it tries to start up - its splash screen displays, but goes no further than that.
I went to Program Files\WindowsApps, and when selecting it got, "You don't currently have persimmons to access this folder, click continue to continually get access"
That leads me to "You have been denied permission to access this folder; to gain access to this folder, you will need to use the security tab"
Click the "security tab" link takes me to that tab, and a "For special permissions or advanced settings, click Advanced"
I do so.
That takes me to a Permissions tab, which says, "You must have Read permissions to view the properties of this object; Click continue to attempt the operation with administrative permissions"
I then selected (one at a time, as that is all it allows):
Trusted Installer : Full control
System: Read, Write, and Execute
System: Full Control
Administrators: Read & Execute
But so far, none of that seems to do anything good.
UPDATE 2
This problem has just "gone away" today; I don't think it was anything I did. I added a UserControl, tried running the app again, and now it runs - I don't see that error message. However, I do see a seemingly unrelated one. (at least I got further).
I just had this problem on a fresh install of Windows 8.1 on my laptop. I'm not sure which one of these steps solved it, but until somebody can give you a more exact answer here is something to try as I am sure you are keen on coding.
Only Store Apps run from VS gives that error, other Store apps work fine.
I first of all changed permissions on my WindowsApps folder under Program Files and made sure that I had full access to the folder and sub folders. Restarted the laptop, still no luck.
Then I set up an admin guest account (just something I tend to do for when I need to record tutorials- so not related to trying to solve the error). Out of curiosity I tried to create and run the same Windows Store App and got an error that another user had installed the app. Strange, how was it installed if it gave me the error that it couldn't activate the app on the main account?
I logged back in as the main user and uninstalled the application (which was showing up as installed), and I can now run any Store App from VS without problems.
Not sure this is an answer since I'm not sure what made it work, but give it a try and hopefully somebody else can clear this us up. I'll investigate further, but I'm on a train right now with poor WiFi connection :)
Best of luck!
I had the same scenario, here are the steps I did to resolve:
I tried to create packages, chose not to associate with the store.
It said that the certificate is expired, I created a new test certificate.
I created the test packages successfully.
Tried to run the project from VS and it finally ran.
I believe all of this had to do with the certificate. very frustrating and time wasting issue.
I also had the same problem and following steps fixed it. Hope it will help some one else.
Open the appxmanifest file
Go to "Packaging" tab
Select "Choose Certificate" and select "Pick from certificate store" and select your cetificate and click on ok
I am using push notifications to watch changes. When I add or update a file everything is ok.
When I delete a file (i.e. it goes to bin) then I do get a notification for that file lets say changeid=81477. When I go to get that change I find that it no longer exists so I can't work out what changed. However if I then go and look at changes I can see a change id=81478 that I never received a notification for. Looking at this change I can see that explicityTrashed = true, which is indicates this is related to the deleted file.
Now, my guess is that change 81477 was superceded by 81478 for some reason, but why do I not receive a notification for 81478?
Someone (non-google) on google+ suggested keeping a track of last change processed and grabbing all changes greater than that when a notification arrives, but this is a workaround to me.
The problem I have is not getting one of the notifications at all. I am posting here in the hope that someone from Google can answer this satisfactorily.
Is it a bug? Or is it expected?
Should we not rely on getting all changes from notifications and implement something similar to suggested?