Download embedded PDF from Firefox using RSelenium - rselenium

I am trying to download the embedded pdf from the following page using RSelenium: https://rac.anpad.org.br/index.php/rac/article/view/1479/1672
# Access the web page (this works fine):
library(RSelenium)
driver <- rsDriver(browser = "firefox")
remote_driver <- driver[["client"]]
remote_driver$navigate("https://rac.anpad.org.br/index.php/rac/article/view/1479/1672")
# Download pdf (this is the part not working)
button <- remote_driver$findElement(using = "css selector", "span:nth-child(1)") # this seems to be working
button$clickElement() # but nothing happens here
But nothing happens, not even an error. Can someone tell me what is wrong? Is there a problem with the css selector? Or maybe with Firefox settings? I appreciate any help!! The best solution would include being able to set the file name to be downloaded.
Obs: I made a similar question here (How to download embedded PDF files from webpage using RSelenium?), but since I got stuck in the download step, I decided to post a simpler problem.

I was able to download the file by,
library(RSelenium)
driver <- rsDriver(browser = c("chrome"))
remDr <- driver$client
remDr$navigate("https://rac.anpad.org.br/index.php/rac/article/view/1479/1672")
remDr$findElement(using = "xpath",'/html/body/header/a[3]') -> downloadfile
downloadfile$clickElement()

Related

unclear (for me) error on loading url using chrome webdriver in selenium

I had a working python script to do some basic data scraping from a local IP address using selenium and chromedriver. The working version used the executable path to define where chromedriver.exe was.
I had to change this as it stopped working (wouldn't load chrome anymore, chromedriver version definitely correct) so swapped the path to a service object.
My script now opens chrome again, but gets hung up with 'data:,' in the address bar, until it times out (after 1 minute exactly) and an error message 'selenium.common.exceptions.WebDriverException: Message: unknown error: DevToolsActivePort file doesn't exist'
Sidenote - a new bug I've noticed since changing this: if I have a chrome window open already, the script opens a new tab with url 'data:,' nut without the little bar saying chrome is being controlled by automated software, and I get an error saying 'selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited normally.'
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import Select
from webdriver_manager.chrome import ChromeDriverManager
s = Service(path to folder "chromedriver.exe")
url = "http://the page i'm after"
driver = webdriver.Chrome(service=s)
driver.get(url)`
after this, the script fills in a form, hits submit and does a bit of scraping. But currently it just gets stuck with a url of 'data:,' and times out after a minute and then I get the error - 'selenium.common.exceptions.WebDriverException: Message: unknown error: DevToolsActivePort file doesn't exist'
It was working a few days ago and I can't think of anything that changed on the site I'm using or anything else!
I think there are unnecessary imports, but I've tried a few things and got a bit lost...
Thanks a lot for any help or tips, I'm pretty new to coding in general, so was very quickly out of ideas
EDIT, running with chrome options "--headless" there is no problem. Can anyone explain why this works?

Why is json files not accessible after build?

I have a project in react that works on the computer excellently.
But after I do build and upload it to the server all the json files in the public folder get a 404 error (even when I try to access them directly and click on the url I get the same error.)
But the icon and png files from the same folder do appear.
Another problem (which is probably also related) is that when I go through the link pages on the site it goes great. But if I type them directly in the url I get a 404 error message
I tried to add to json
"homepage": ".", "
But even that did not help.
Anyone have an idea?
edit:
the json works .. I had to change the settings of the mime types according to the instructions: https: //docs.plesk.com/en-US/obsidian/administrator-guide/website-management/websites-and-domains/extended- website-management / using-virtual-directories-windows / adding-and-removing-mime-types.65216 /
But I was still left with the problem that when I go directly to the url address it makes me an error page (when the project is on the local host, it works fine!)
Regards,

Allow file downloading with routes in Codeigniter

I have this route defined $route['download/(:num)/(:any)'] = 'download/index/$1/$2';
What I want is, mydomain.com/download/444/filename.mp3. Now problem is when I pass the url without extension .mp3 it works fine, but when I give url with .mp3 it shows 404 of nginx. i.e.
mydomain.com/download/444/filename.mp3 ERROR
mydomain.com/download/444/filename SUCCESS
You can try this solution for your problem:
$route['download/(:num)/([a-zA-Z0-9.a-zA-Z0-9]+)'] = 'download/index/$1/$2';
I Hope it will help you.

angular js path returns 404 error when https is used

Please keep in mind, I have not worked with angular JS, nor did I write the code that is causing the error.
I am getting an 404 error on this path:
https://www.helivalues.com/Su6UsWuf/bb/option/mfg/all
but not this path:
http://www.helivalues.com/Su6UsWuf/bb/option/mfg/all
It was noticed that when a user views a certain page in https, the drop down does not load options. Angular Js makes a call to the path mention above which is not an actually file but is used by a php file that based on this path, has a switch that fills in the drop down.
Any ideas on how to get the https version to work? This is on a joomla site and I do have access to the htaccess file if needed. I really just need it to work for a few months while I work on building a new site.
Thanks!
Angularjs is not the issue. Your webserver (Apache/2.2.15 (SuSE) Server at www.helivalues.com Port 443) states the file can not be found. So it looks like something is misconfigured with your apache site.

Run executive dashboard example in EXT-Js

I am trying to run EXT-JS 5 executive dashboard example on my local machine. I could see the code for executive dashboard in the folder "build/examples/executive-dashboard" . However this code is compressed and could not read.
The other location where I could locate the code for executive dashboard is in the examples folder. However I could not run this uncompressed code. At the same time I could see that there are no css files in examples/executive-dashboard folder.
Do I need to run any sencha command to get the code in examples folder running on server ? If so is there any way that I can run it without using sencha command ?
Please advise.
Thanks
Samir
Is your HTTP server running? You cannot run this, neither many of other, example using file:// protocol but you have to use http:// protocol.
So your url should look similar to: http://localhost/ext-5.1.0/examples/executive-dashboard/

Resources