Python selenium redirect page to after logging in a Webpage - python-3.x

I am using Selenium for automating a form filling. For this, I have to first login, then navigate to another page after logging in (or browse from the list of sectional wise options of Webportal and then search from list of IDs). I am successfully able to login but unable to change url to the required page which I wish to browse and land.
Is there a way how to browse and navigate through the sectional tabs after login page is opened. It might be difficult to browse(as it is deep inside nested sections) and that is why I am directly trying to give URL to the required ID which I want to open.
When I use
WebDriverWait(driver,DELAY)
driver.get(desired_URL)
to navigate after login, it automatically makes me end up on the homepage before logging in. I also tried another Method
WebDriverWait(driver,DELAY).until(driver.get(desired_URL))
. This gives me an error TypeError: 'NoneType' object is not callable. Nothing worked for me. But actually this should not happen. After successful login, it should navigate to the page which I specify in driver.get(desired_URL) . I know in javascript there is a particular option like driver.navigate().to(<desiredURL>). But I am using Python for my automation.
I would be really greatful for any of your helpful leads in solving my problem.

Related

How to navigate to a URL from a Power app

I have some customized list forms.
I would like to navigate to the site home page/other URL on success of the form.
Is there any possible method to accomplish this?
EDIT: Currently when the form is closed, the user is taken to the concerned list.
Use the Launch function.
For example
Launch("https://www.stackoverflow.com")
You can also pass parameters. Read the full documenation here:
https://learn.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-param

how to script a button that saves the user's websites browsing history in livecode

I need your help
I am programming a URL browsing site when you long press on the button named site01 it will enable you to type a URL, and I need your help in how to script a button that saves the user's websites browsing history and is there a way to know that the website URL which the user has entered is active and correct, I am still a beginner
Check out browserNavigateComplete in the Dictionary. This may enable you to manually record the navigation changes inside the browser object. (i.e. add the URL to a list of sites, or an array for example.)
Also check out the lessons on LiveCode's site, such as: http://lessons.livecode.com/m/4069/l/22836-how-do-i-use-the-browser-control

codeigniter secure opening of pdf file in new tab

There are many similar questions to this but none quite answers my problem. I have users who wish to be able to access certain pdf files via a password. I have set up a page, accessed via a password, and the page contains links to each pdf. I have added an .htaccess file into the folder with the code 'deny from all' which successfully defeats any attempt to type in the url directly. (Unfortunately the pdfs are of a nautical magazine called 'The Log', in a folder called 'log' with endless scope for confusion over logging in. Sigh.) At present, when users click on a link for one of the pdfs, a direct link wouldn't work because of the protecting .htaccess file. So they are taken to a controller method as below:
function loadlog($year='',$filename='')
{
$realpath = 'public/pdf/log/'.$year.'/'.$filename;
$tofile= realpath('public/pdf/log/'.$year.'/'.$filename);
header('Content-Type: application/pdf');
readfile($tofile);
}
This works fine except that the pdf opens in the same window. I would prefer not to do that as clicking the browser back button calls for more clicks to resend the page request. How can I get it to open in a new window ie the same effect as if I had been able to use a direct link with target=_blank?
Or have I tackled the entire problem the wrong way?

how to provide request_url with specification while web scraping using python

I'm on the web page with the url=x
The url of that particular web page doesn't change after giving my preferences(like selecting options,..) or after clicking the button on that web page.
Problem:
Before performing the above mentioned actions i will not be displayed with any data; but post actions the web page displays the data.
Context:
I'm trying to scrape data from a web page using python
And i'm struck at providing the request_url with the above mentioned specification
if i'm providing request_url=x it is fetching no data because i have provided no specifications
How to provide those specifications while requesting with the url?
kindly address the specification of pressing the button also
Sounds like you're trying to scrape data through real navigation actions, like filling form data and clicking on buttons and/or posting some data, considering whatever javascript scripts contains in the page, but you don't have the specifications to post the data.
My approach would be automating a real browser using selenium, finding the button via xpath or id and calling a click function to it.
driver.get("http://www.google.com")
# Assume the button has the ID "submit" :)
driver.find_element_by_id("submit").click()

SharePoint page with usercontrol is giving You are not authorized to view this page error

I have an unusual scenario in which only one page of our SP 2007 site is throwing this error "You are not authorized to view this page".
Here are some details:
SP 2007 Enterprise
The page in question uses SmartPart to display custom usercontrol.
We have 50+ pages that also use custom user controls in SmartPart, and none of them generate this error.
The page in question has several functions, and it initially loads just fine. First time it loads, user selects a customer from a dropdown, then enters a search query and clicks the search button. That all works, and the page then returns some search results. That works as well. The the user can click on a Modify link for each item. It's clicking on this Modify link that generates the page error. All of these things are done one this one page, it just refreshes accordingly. The Modify link is just a standard asp:commandline field that causes the page to load the line item in editable mode.
Here's the other strange thing. If I login as the SP Administrator account, and go to this page, it all works properly, no errors...and, then all other users can go in and use the page properly, without errors as well. It's as if whatever the security issue is, is being resolved temporarily as a result of the Admin using the page first. But after a code publish, or IISRESET, etc, the page goes back to not working for any general users.
Any ideas on what I should look for in trying to resolve this issue? I can also provide code if anyone thinks that may be relevant.
Thanks!
use SPSecurity.RunWithElevatedPrivileges for running your code with anonymous access user:
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite(web.Site.ID))
{
// implementation details omitted
}
});

Resources