Answer the question
In order to leave comments, you need to log in
How to access an element of a python array?
Thanks to
title = driver.find_elements_by_class_name('title')
in selenium I find the necessary elements, let's say there are four of them: for titles in title:
print(titles.text)
Answer the question
In order to leave comments, you need to log in
Hello. I'm not familiar with Selenium specifically, but in Python you can refer to an element by index if, in fact, the title object supports indexing
First, try title[1].text
If it doesn't work, you can look in the documentation for a method that returns an indexed object, and if it doesn't exist, you can convert title, or its iterator, to a list with something like [i for i in title], or list(title)
1. You cannot find out the full path to a file on a disk on a user's computer from php/js.
You can only get the file itself (when submitting the form) and its name.
*In principle, you can get the content of the file, but again, you will not do anything except send it to your server. ( www.html5rocks.com/ru/tutorials/file/dndfiles )
2. You cannot write a file from php/js to a user's computer at a specific path.
You can only initiate the download of the file by the user, and he will choose where to save it.
In general, I went a little different way ... The motive is to finish today, and they will pay me no more than $ 10 for it :)
1. I receive the file with the standard input type='file' and submit the form.
2. I accept the form and take the file name.
3. I use the function (just looking for a file):
if (!defined("__DLIB_FILEFIND_DEFINED"))
{
define('__DLIB_FILEFIND_DEFINED', TRUE);
function filefind ($basedirectory, $needle)
{
$handle=opendir($basedirectory);
while ($file = readdir($handle))
{
if (($file == ".") || ($file == ".."))
continue;
if (is_dir($basedirectory . '/' . $file))
{
$subDirResult = filefind($basedirectory . '/' . $file, $needle);
if ($subDirResult != "")
{
closedir($handle);
return $subDirResult;
}
} // if (is_dir($file))
if (strcmp($file, $needle) == 0)
{
closedir($handle);
return $basedirectory . '/' . $needle;
}
} // while ($file = readdir($handle))
closedir($handle);
return "";
} // function filefind
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question