Python selenium webdriver - textbox and button won't work - javascript

I have been playing around with selenium webdriver library for python, I have some programming knowledge but almost none when related to webpages etc.
I am trying to login to this website https://freebitco.in/ I click on the login button, fill the textboxes and then click on the button with selenium but the page just refreshes leaving the inputs blank and nothing happens.
I have tried to manually (ctrl+V) inputing the text and then clicking on the button with selenium, in that case it works. I would love an answer for this fenomenon. I would also like to know how can a webpage differentiate between bot input and user input, from my point of view (no webpage knowledge) I can only see it being able to work with the guest timing etc to tell it's a bot or not, how can it see it is a bot writing in this textboxes? (if it is the case).
Thank you for your answers and forgive my poor english skills. (:
This is my code:
driver.find_element_by_class_name('login_menu_button').click()
driver.find_element_by_id('login_form_btc_address').send_keys(address)
driver.find_element_by_id('login_form_password').send_keys(password)
driver.find_element_by_id('login_button').click()
this is for the textboxes:
<input type="text" name="btc_address" id="login_form_btc_address">
and this is for the button
<input type="text" name="btc_address" id="login_form_btc_address">

From what I see on that page:
<li class="login_menu_button active">
LOGIN
</li>
So even though you are clicking on top menu, I think you are not opening login form Try to change the first click to be on link element:
driver.find_element_by_link_text('LOGIN').click()
Also you will probably need to synchronize between clicks (i.e. check that what you expected indeed happened)

Related

PWA Automated test with Selenium IDE

I'm having trouble automating PWA tests using selenium IDE.
Indeed I fill a form and at the time of saving the button "css=.hover\3Aopacity-90" remains grayed whereas I filled all the obligatory fields.
I also have the same problem when I switch from one page to another with toaster eruption and when I want to select a label in a dropdown list through the search bar "id=headlessui-combobox-input-".
If you can help me to move forward please. Thanks

How to keep a hover effect by selecting a browser suggestion?

I have a WordPress + WooCommerce website and by hovering Login / Sign Up on the header it leads to open a dropdown box where you can enter login details or register. The kind of issue described below also occurs on official theme demo website, at https://xstore.8theme.com/
Now, if I click on "Username or email address" field, Google Chrome shows me an account suggestion based on previously saved accounts on this website. You could try by attempting to login with whatever credentials and if you save them on Chrome (even if wrong), the browser will suggest them to you from the next login attempt. If you just hover the suggestion, all the dropdown box disappears. I said, "just hover the suggestion", because actually you do not have time to click on it.
I suppose this is due to hover effect, in fact if you move the cursor out of the dropdown box, this last disappears, and so happens with the suggestion making it like it was out of the dropdown box.
You can watch a video of the issue at:
https://s.nimbusweb.me/share/3721505/q5vwlz9bho2yufufoiic
How could I solve that?
Thank you in advance,
Alberto
I've had this Problem many times with outdated versions of chrome.
Have you tried updating your browser?
Do you have the same issue in other browsers?
Running updated chrome, I have not experienced this issue on the Demo Page (https://xstore.8theme.com/)

Load testing with Asp.net site- issue regarding database entry

I want to load test one scenario for the load testing a ASP.net site.
There is one grid of records that contain kind of scorecards.
When user Click on view for any one record, new Tab will open with that scorecard detail. And in which user can select Review or Dispute radio button and simply submit the form.But when user click on the Submit button, one pop up comes with the OK button in it. And when user click on the OK it will close the newly open Tab(score card detail) and update/refresh the that Grid page.
So while recording of the scenario when I click on the submit button I am not getting any confirmation pop-up(as Jmeter is not able to execute Java script). and also there is no database entry for that form submission.
This scenario is working fine in normal user actions(without Jmeter).
While recording I can also see the Request recorded for Form submission but not reflected in database.
I am not sure if this is because of the limitation of the Jmeter of inability to execute Java script or something related to Proxy settings.
But after the talk with the developers they said before the java script alert, another code/method is executed for database entry. So could not figure it out what exactly the problem is SO looking for some help from you guys.
jmeter- during its execution runs in non-ui mode while java script is used for basic validations and making the user interface comfortable
a better approach or a solution is to have a chat with the developer to disable the pop up and complete the action without a popup (or a button within browser itself in case of any dependency of button to execute the functionality) in your local environment to proceed further

Alternatives to disabling / disable back button in firefox and IE

Our application forbids going back for several reasons.
Basically because that's just how our application works (JSF with facelets as GUI)
You always have to enter on the welcome site, once you chose an application-flow you can only leave / abort when you tell the application (e.g. press a button). If you just browse away e.g. enter "example.com" in the address bar the state of your flow gets saved and once you relogin, you can resume the work. Going back is only possible when it was specifically designed like this with a 'back' submit - button.
Of course users keep pressing the 'back' button (i would do so as well) and they keep getting 'error: session out of synch'. This is a learning process and a couple years ago we just disabled the back-button to make things clear. Sadly this is no longer supported.
So instead of teaching the user the hard way and forcing him to relogin, are there some good alternatives I'm missing?
i found this link which should offer 3 methods to disable the back button - but in reality it just further confirms the fact that it is impossible to do it in a semi-nice way.
when the user tries to go to a previous page you can redirect him to the page he should be at in other words catch the "out of sync" and redirect him
You might find a workable solution here How do I insert an entry into browsing history via JavaScript
by inserting an extra step into the browser's history (perhaps a link to the current page with query string parameters that result in a nice big red box message to the user), or you could try attaching an event handler to the OnBeforeUnload event so the user gets a confirmation dialog when trying to leave the page (you'd want to remove the handler when the submit button was clicked).

JavaScript problem toolbar=no

I have a simple logon page. When the user is validated, the window navigates to a new page. The javascript is window.open('http://www.google.com',"mytest",'toolbar=no'); My expectation is that when it navigates away from our logon page and opens the google site that the back button would be disabled. But it's not. Does anyone have any idea why?
It depends on your browser. Ultimately, all you can do with javascript's window.open() is tell the browser what you'd like it to do, but it's not obligated to do it. Browsers can and do ignore some directives based on user preferences.
I believe the option your looking for is 'location=no', as that hides the address bar and therefore the back button too. The toolbar is things like favorites/etc.
This is bad practice - what happens if the user has javascript disabled? If the browser prevents the js from removing the toolbar of the main window?
Instead, amend the logon page to detect whether the user is logged in before showing the login form. If logged in, show a message saying so instead of the form - that way, a user clicking back won't be a problem.
I find it very annoying when a website messes around with my browser window, and generally don't come back.
This is what worked for me. Instead of disabling the back key. I listen for on unload event. I then write the following in javascript:
window.onbeforeunload = function () { return "You should not press the back button while in this application. If you continue, your work will not be saved and you will need to log back in."}
Java Script pops a dialogue box with OK and Cancel options. If the user clicks cancel. The application stays right where they are. The script is embedded within the tags. For me this is the ideal solution. I found this at
http://www.hunlock.com/blogs/Mastering_The_Back_Button_With_Javascript

Categories