If I am on the following page:
http://subsite.mysite.com/sites/department/class/SitePages/Home.aspx
and want to have a link to
http://subsite.mysite.com/sites/department/SitePages/Home.aspx
i.e. I want to keep /sitepages/home.aspx and move it one step up in the hierarchy
and not hard code http://subsite.mysite.com/sites/department/
Is this possible?
Thanks in advance.
Try:
My Link or
My Link
Related
I have created a partial view which will show the menu with unordered list. I want to add links to each li element. I have done my research and tried different ways like giving relative path, absolute path etc. but it does not open the view page. It shows 404 error in browser.
Am I missing to add something in partial view which can then open the view page on clicking the li tag item.
<li>Powershell Comments</li>
Any guidance would be greatly appreciated.
You should change link like "/Controller/Action".
Code at the below will work fine if the names of action and controller are correct.
<li>Powershell Comments</li>
You should use #url.action() method.
This is an update to link to a place in a locally-hosted website
I tried the solution:
<a href="http://127.0.0.1:5500/#projects"><button
onmouseover="onbutton(this)" onmouseout="offbutton(this)"
type="button">Projects</button></a>
while it does change the link in my browser from 127.0.0.1:5500 to 127.0.0.1:5500/#projects, it does not take me directly to the div tagged with id #project- it just leaves me at my current place on the website. How can I fix this?
First, as observation, this is not a CSS question. Here we go.
When you use an anchor with the ID attribute, you dont need to use the entire URL. just the #id
I've been trying to access/locate the element shown in the image and have tried various methods. xpath, classname, css but keep getting the error that the element cannot be found. Can you help please ?
Attempt1
driver.find_element_by_class_name(".btn.btn-default").send_keys(os.getcwd() + "InputFiles/Error.png")
Error:
Attemp2:
driver.find_element_by_xpath("//div[#class='upload-btn__wrapper']").send_keys(os.getcwd() + "InputFiles/Error.png")
Error:
This xpath is supposed to work.
"//div[#class='upload-btn__wrapper']/button"
Hope this helps. Thanks.
Hope it help you. Let me know if you need further assistance.
driver.find_element_by_xpath("//div[#class='upload-btn__wrapper']")
I suggest to use below Xpath as it will rely on your Text, so any changes in text of the button will result a failure of the test, which makes perfect sense.
//button[normalize-space(text())='Choose image']
Also use explicit wait before performing any operations with that element.
new WebDriverWait(driver, time).until(ExpectedConditions.visibilityOf(By.xpath("//button[normalize-space(text())='Choose image']")));
WebElement chooseImageButton=driver.findElement(By.xpath("//button[normalize-space(text())='Choose image']"));
chooseImageButton.click();
Try the below solution as well :
driver.findElement(By.xpath("//div[contains(#class,'margin-bottom')]")).findElement(By.xpath("//div[contains(#class,'upload-btn__wrapper')]")).click();
Explanation : I am navigating from the parent div which is "margin-bottom" div class and reaching out to the child div which we want to locate, which is "upload-btn__wrapper".
Let me know, if this works out.
You can click on it with css selector also. Hope this will work for you.
driver.findElement(By.cssSelector(".btn.btn-default")).click();
I have my button that targets to index.html, but after I click them, my url above is domainname.lt/index.html, but all I want is domainname.lt. What should I do? I have no knowledge what to search. I'm using 'href' attribute.
Thank you in advance.
You should use PHP with the $base_url global variable. Here is a good tutorial on how to use it: https://api.drupal.org/api/drupal/developer!globals.php/global/base_url/7
Hope this is what you mean :D
Both domainname.lt/index.html & domainname.lt will display the same. If needed peculiar,
your link should be like this:
link
Use full url or set it to a variable as global.
$GLOBALS['a'] = 'domainname.lt';
On my site the twitter links open in the parent window. I can't find any reference to the links in the HTML any ideas how to make them open in a new window?
www.wefewlondon.com
Thanks
The tweet markup is generated by the jQuery.tweet plugin. They explain how to achieve the desired outcome in example #6 on their homepage.
Effectively, all you need to do is add this line at line 33 of your main.js:
$(this).find("a").attr("target","_blank");
I looked at your javascript/lib/jquery.tweet.js file.. look at the
return ""+escapeHTML(text)+"";
part... add "target="_blank" and that should do it
return "<a href=\""+escapeHTML(url)+"\ target=_blank>"+escapeHTML(text)+"</a>";
Where the link is written, for example here:
$2
You can append the target attribute:
$2