For my daily work, I'm trying to create a Python Script which is able to fill in different forms, from different websites.
Here is the thing, for some kinds of website, I'm not able to catch the form elements which Selenium. E.g. in this website : https://econnect.bpcl.in/selfservice-ext/pub/login.html Where I inspect the page with Chrome, the input "User id" box has the id "principal", but Selenium is not able to get it. And when I display the html code of this page, the form looks like being included from another page or something.
I tried to getelementbyid, byname, bycssselector, etc. I also tried to wait for the page to be entirely loaded by using WebDriverWait(driver, 5), but it still do not work.
i also tryied driver.execute_async_script and driver.execute_script
Do you have any solutions or suggestions ?
PS : Even with javascript, I'm not able to get this element by id
Thanks
You can try to use x-path, I'm using a chrome extension: https://chrome.google.com/webstore/detail/xpath-finder/ihnknokegkbpmofmafnkoadfjkhlogph?hl=en
To locate the element you want to fill
And then you can use
driver.find_element_by_xpath("X-PATH").sendkeys("...")
If you don't want to download a chrome extension you can try to go the HTML script, but I doubt it would work because you said it wasn't working for you...
Related
I need some help. I need to download financial statements that are located in PDF files to my MAC using Python. I've tried this using Selenium but unfortunately haven't been able to make progress.
Following is the URL: financials.psx.com.pk
When I load this URL, the page looks like so:
you see the dropdown on the left above "Company Name...", I need to select a company name there. Once I do that, then I see a window like this:
Every link under reports, when clicked downloads a PDF. I require those PDFs. Appreciate any help. Thanks.
I have tried the following code; it selects the company name and shows me the next page for a second but somehow another refresh happens, which leads me back to the original page:
driver = webdriver.Chrome(executable_path="driver-path")
driver.get("https://financials.psx.com.pk/")
elem = driver.find_element_by_id("country")
drp = Select(elem)
drp.select_by_value("SHEL")
Actually, when I select using select_by_value, I can see the second window. I think the code is not stable. But, I am able to select a symbol from the dropdown and see the second page. Now, I need href's from the second page behind links such as 'Quarterly', 'Annual' etc.
I'm trying to retrieve text that is loaded dynamically from a web page using golang.
The text to retrieve is on this page :
https://www.protectedtext.com/testretrieve?1234
This text is encrypted by a password and then decrypted on client side and loaded dynamically on the page.
I already tried with goquery by selecting 'textarea' object, but I can't get the text cause it's loaded dynamically.
How can I achieve this ? By executing JS in Go ? It's working in my chrome console, but no ideas on how to do that in Go.
A lightweight solution is the best for my project. Or any other website that can store and edit same text without modifying the URL ?
You may need a headless browser to load the javascript like for example phantomgo
However looking at the page source code we can see that they use sha512 for the tab title and aes for the textarea field.
The page which you shared contains https://www.protectedtext.com/testretrieve?1234, only one element of class textarea-contents
simple get class documents using goquery and get 0th part
I created a wordpress template for a customer and I used a plugin to allow registered users to customize his profile. The issue appears when I'm trying to change the profile photo, the modal windows that allow that don't charge!
Please see this picture: http://tattoobiter.com/custom.png
I tried to insert manually (in chrome console)
<div id="um_umpload_single"></div>
in </div class="um-modal no-photo"> and it works correctly till refresh the page.
I think something of my template don't let javascript to charge correctly, but I can't understand what...
Please help!
I tried to insert the first div in the second with append jquery but don't work...
Problem solved, It seems wordpress have problems to charge javascript external scripts if don't have the "".
I am trying to locate an element(tabs) on a webpage using its xpath but instead of locating it, the code is selecting the tab just above it. Xpath used is absolute. Please suggest on this, anyone.
Following is the code snippet:
WebElement table=(new WebDriverWait(driver,200)).until(ExpectedConditions.presenceOfElementLocated(By.xpath("//tagname[#title='value']")));
Thread.sleep(500);
table.click();
tabs in this context,basically are webpage titles arranged one below the other in form of tabs,one can access these webpages on clicking on these tabs.
I'm using SSRS208R2 to create reports.
I display these reports using a ReportViewer control in my web application.
some of the fields in my table are tags that user javascript:void window.open...
to opent a link in a new window.
I use Jump to URL action for my placeholders to achieve that.
The Problem:
My report is displayed in a separate domain.
ReportViewer Control renders the tags with target='_top' property.
IE will not let any href='javascript:void alert....' action to run from a different domain Iframe if the target is _top.
Questions:
is there a way to define a different target for an anchor tag - i have search some places and found that the SSRS web application can use rc:LinkTarget=_Blank to chage all the targets but that dosent seem to work for me. are there any other possible solutions?
Can anyone suggest a different approach to open a link in a new window that will not hit a wall when the report is displayed from an Iframe on a different domain ?
Solved!
I tried the query string "rc:LinkTarget" at the built in reporting services web interface..
and that did not work for me initially.
Then I tried to changed the location of that parameter and it worked.. I really don't think that that was it maybe there was a spelling error or something, anyway...
So I did some more digging and found that the report viewer control has the same property called LinkTarget I used it to define an empty string and everything works fine.
Cheers...