Read the Name of an item on Website by Id - vb.net

I'm using the Webbrowser1.Document.GetElementById command.
Private Sub Button5_Click(sender As System.Object, e As System.EventArgs) Handles Button5.Click
Dim Col As String = ""
Try
Col = wb1.Document.GetElementById("_arialId_118.row.cells.displayName").Name.ToString()
Catch ex As Exception
MessageBox.Show(MessageBox.Show(ex.ToString()))
End Try
MessageBox.Show(Col)
End Sub
I know that the ID is correct, because I checked it maually. However, i still get a NullReferenceException. What could be the cause of this?
EDIT: Document Example:
<button type="button" class="_ph_I6 _ph_T6 o365button" tabindex="-1" role="group" id="_ariaId_118.row.cells"><div class="_ph_J6"> <div class="_ph_U6 _ph_R6"> </div> <div class="_ph_P6 _ph_R6 ms-font-color-neutralPrimary" tabindex="-1"> <span picturesize="50"> <span class="_ph_Q6 ms-font-weight-semilight PersonaPaneLauncher"><div class="_pe_d _pe_92 _pe_K _pe_i" role="button" tabindex="0" aria-expanded="false" aria-label="Persona-Karte" aria-haspopup="true"> <span class="_pe_j"> <div class="_pe_o2"> <span class="_pe_t _pe_R1 owaimg _pe_l2 _pe_q2 presenceJellyBeanBase presenceJellyBeanSmallBase presenceJellyBeanOffline" style=""> </span> </div> </span> <span class="_pe_n"> <div class="_pe_D1"><div style="display: none;"></div><div><div><div class="nonDraftPart _pe_12 _pe_j2 _pe_v2" style="background-size: cover; background-position: center center; background-color: rgb(43, 87, 151);">AA</div></div><div style="display: none;"></div></div></div> </span> <div style="display: none;"></div> </div></span> </span> </div> <span class="_ph_R6"> <span class="bidi _ph_S6 _ph_O6 disableTextSelection" tabindex="-1" role="button" id="_ariaId_119.row.cells.displayName" title="Abba Alessio">Abba Alessio</span> </span> <span class="_ph_R6"> <span class="bidi _ph_S6 _ph_O6 disableTextSelection" role="button" tabindex="-1" id="_ariaId_119.row.cells.emailAddress" title="Alessio_Abba#vs.sluz.ch">Alessio_Abba#vs.sluz.ch</span> </span> <span class="_ph_R6"> <span class="bidi _ph_S6 _ph_O6 disableTextSelection" role="button" tabindex="-1" id="_ariaId_119.row.cells.jobTitle" title="VSAD-Schüler">VSAD-Schüler</span> </span> <span class="_ph_R6"> <span class="bidi _ph_S6 _ph_O6 disableTextSelection" role="button" tabindex="-1" id="_ariaId_119.row.cells.officeLocation" title="VS">VS</span> </span> </div></button>

Try the following code instead:
Col = wb1.Document.GetElementById("_ariaId_119").Name.ToString ()

Related

Selenium WebDriver could not locate CKEditor iFrame and enter text

Here is html code. I used iFrame class to identify and but unable to locate
<textarea class="form-control qlib-ck-editor" cols="20" id="QuestionText" name="QuestionText" onload="initializeCkInstance('QuestionText');" rows="7" style="visibility: hidden; display: none;"></textarea>
<div id="cke_QuestionText" class="cke_1 cke cke_reset cke_chrome cke_editor_QuestionText cke_ltr cke_browser_webkit" dir="ltr" lang="en" role="application" aria-labelledby="cke_QuestionText_arialbl"><span id="cke_QuestionText_arialbl" class="cke_voice_label">Rich Text Editor, QuestionText</span>
<div class="cke_inner cke_reset" role="presentation"><span id="cke_1_top" class="cke_top cke_reset_all" role="presentation" style="height: auto; user-select: none;">
<span id="cke_14" class="cke_voice_label">Editor toolbars</span>
<span id="cke_1_toolbox" class="cke_toolbox" role="group" aria-labelledby="cke_14" onmousedown="return false;">
<span id="cke_15" class="cke_toolbar cke_toolbar_last" aria-labelledby="cke_15_label" role="toolbar">
<span id="cke_15_label" class="cke_voice_label">Basic Styles</span>
<span class="cke_toolbar_start"></span><span class="cke_toolgroup" role="presentation">
<a id="cke_16" class="cke_button cke_button__bold cke_button_off" href="javascript:void('Bold')" title="Bold (Ctrl+B)" tabindex="-1" hidefocus="true" role="button" aria-labelledby="cke_16_label" aria-describedby="cke_16_description" aria-haspopup="false" onkeydown="return CKEDITOR.tools.callFunction(1,event);" onfocus="return CKEDITOR.tools.callFunction(2,event);" onclick="CKEDITOR.tools.callFunction(3,this);return false;">
<span class="cke_button_icon cke_button__bold_icon" style="background-image:url('https://qlib-qa.azurewebsites.net/Scripts/ckeditor/plugins/icons.png?t=I3I8');background-position:0 0px;background-size:auto;"> </span>
<span id="cke_16_label" class="cke_button_label cke_button__bold_label" aria-hidden="false">Bold</span>
<span id="cke_16_description" class="cke_button_label" aria-hidden="false">Keyboard shortcut Ctrl+B</span>
</a>
<a id="cke_17" class="cke_button cke_button__italic cke_button_off" href="javascript:void('Italic')" title="Italic (Ctrl+I)" tabindex="-1" hidefocus="true" role="button" aria-labelledby="cke_17_label" aria-describedby="cke_17_description" aria-haspopup="false" onkeydown="return CKEDITOR.tools.callFunction(4,event);" onfocus="return CKEDITOR.tools.callFunction(5,event);" onclick="CKEDITOR.tools.callFunction(6,this);return false;">
<span class="cke_button_icon cke_button__italic_icon" style="background-image:url('https://qlib-qa.azurewebsites.net/Scripts/ckeditor/plugins/icons.png?t=I3I8');background-position:0 -24px;background-size:auto;"> </span>
<span id="cke_17_label" class="cke_button_label cke_button__italic_label" aria-hidden="false">Italic</span><span id="cke_17_description" class="cke_button_label" aria-hidden="false">Keyboard shortcut Ctrl+I</span>
</a>
<a id="cke_18" class="cke_button cke_button__underline cke_button_off" href="javascript:void('Underline')" title="Underline (Ctrl+U)" tabindex="-1" hidefocus="true" role="button" aria-labelledby="cke_18_label" aria-describedby="cke_18_description" aria-haspopup="false" onkeydown="return CKEDITOR.tools.callFunction(7,event);" onfocus="return CKEDITOR.tools.callFunction(8,event);" onclick="CKEDITOR.tools.callFunction(9,this);return false;">
<span class="cke_button_icon cke_button__underline_icon" style="background-image:url('https://qlib-qa.azurewebsites.net/Scripts/ckeditor/plugins/icons.png?t=I3I8');background-position:0 -120px;background-size:auto;"> </span>
<span id="cke_18_label" class="cke_button_label cke_button__underline_label" aria-hidden="false">Underline</span>
<span id="cke_18_description" class="cke_button_label" aria-hidden="false">Keyboard shortcut Ctrl+U</span></a>
</span><span class="cke_toolbar_end"></span></span>
</span>
</span>
<div id="cke_1_contents" class="cke_contents cke_reset" role="presentation" style="height: 200px;">
<span id="cke_22" class="cke_voice_label">Press ALT 0 for help</span>
<iframe src="" frameborder="0" class="cke_wysiwyg_frame cke_reset" style="width: 100%; height: 100%;" title="Rich Text Editor, QuestionText" aria-describedby="cke_22" tabindex="0" allowtransparency="true"></iframe>
</div>
<span id="cke_1_bottom" class="cke_bottom cke_reset_all" role="presentation" style="user-select: none;">
<span id="cke_1_resizer" class="cke_resizer cke_resizer_vertical cke_resizer_ltr" title="Resize" onmousedown="CKEDITOR.tools.callFunction(0, event)">◢</span>
<div class="cke_wordcount" style="" title="Statistics">
<span id="cke_wordcount_QuestionText" class="cke_path_item">Characters: 0</span>
</div>
</span>
</div>
</div>

How to get extra-small navigation bar to display without breaking?

What do I have to do to my "extra-small" navigation variant below so that it simply displays in a row instead of stacked?
The larger screens look fine:
<div class="navbar-collapse visible-sm-block visible-md-block visible-lg-block">
<div class="navbar-text">{$company->company_name} - Kundenportal2</div>
<div class="navbar-text">{ $user->title } { $user->givenname } { $user->surname }</a></div>
<a class="navbar-brand navbar-right" href="#">
<span class="glyphicon glyphicon-menu-hamburger"></span>
</a>
<a class="navbar-brand navbar-right" href="#">
<span class="glyphicon glyphicon-cog"></span>
</a>
</div>
<div class="navbar-collapse visible-xs-block">
<div class="navbar-text">nn</div>
<div class="navbar-text">22</div>
<a class="navbar-text navbar-left" href="#">
<span class="glyphicon glyphicon-menu-hamburger"></span>
</a>
<a class="navbar-brand navbar-right" href="#">
<span class="glyphicon glyphicon-cog"></span>
</a>
</div>
</div>
</div>
I think you are looking for something like this: https://jsfiddle.net/0cL2qaq1/2/
CSS
.navbar-text {
float: left !important;
margin-right: 10px;
}
.navbar-right {
float: right!important;
}

How to find a node with xpath having namespace in xml

I am trying to find div node with Xpath for selenium. here div having categories/Accounts & Contacts as value of ext:tree-node-id need to be selected, but as ext:tree-node-id is a namespace my below xpath is not working.
//li[#class='x-tree-node']//div[contains(.,ext:tree-node-id='categories\/Accounts & Contacts')]
//li[#class='x-tree-node']//div[#ext:tree-node-id='categories\/Accounts & Contacts']
<li class="x-tree-node">
<div class="x-tree-node-el x-unselectable folder x-tree-node-collapsed" unselectable="on" ext:tree-node-id="categories\/Accounts & Contacts">
<span class="x-tree-node-indent"/>
<img class="x-tree-ec-icon x-tree-elbow-plus" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" alt=""/>
<img class="x-tree-node-icon" unselectable="on" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" alt=""/>
<a class="x-tree-node-anchor" tabindex="1" href="" hidefocus="on">
</div>
<ul class="x-tree-node-ct" style="display: none;">
</li>
<li class="x-tree-node">
<div class="x-tree-node-el x-unselectable folder x-tree-node-collapsed" unselectable="on" ext:tree-node-id="categories\/Opportunities">
<span class="x-tree-node-indent"/>
<img class="x-tree-ec-icon x-tree-elbow-plus" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" alt=""/>
<img class="x-tree-node-icon" unselectable="on" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" alt=""/>
<a class="x-tree-node-anchor" tabindex="1" href="" hidefocus="on">
</div>
<ul class="x-tree-node-ct" style="display: none;">
</li>
A colon in the attribute will not allow the xpath works. You need to improve a little to it works as you wish, like:
//li[#class='x-tree-node']//div[#*[contains(local-name(), tree-node-id)] = 'categories\\/Accounts & Contacts']
The "local-name" will select the name after the colon named "tree-node-id".

Protractor - Element Not Visible when selecting Drop down.(but visible when selected manually)

i have been searching for 2 days but i couldnt come to a solution, i want a drop down to be selected. When i click on the drop down using some element.all css locator it clicks on the drop down(Drop down Opens up but error displayed). so i tried to use linkText to open up the drop down(Opens up perfectly). But after that i was not able to select the option in the drop down. (Element Not Visible displayed). also i was not able to select the option through the linkText. below r the details
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-right" style="margin-right:0px">
<li>
<div uib-dropdown="" style="margin-right: 5px;" class="dropdown">
Tenant
<a href="" id="simple-dropdown" uib-dropdown-toggle="" class="dropdown-toggle" aria-haspopup="true" aria-expanded="false">
<span class="breadcrumb ng-binding" style="padding-bottom: 2px; padding-top: 2px;">cust1</span>
</a>
<ul class="uib-dropdown-menu dropdown-menu" role="menu" aria-labelledby="single-button">
<!-- ngRepeat: tenant in tenantList --><li ng-repeat="tenant in tenantList" class="ng-scope">
<a ng-click="selectTenant(0)" href="">
<span ng-show="selectedTenant.Identity == tenant.Identity" class="glyphicon glyphicon-ok"></span>
<span ng-show="selectedTenant.Identity != tenant.Identity" style="margin-left: 17px" class="ng-hide"></span>
<span class="ng-binding">cust1</span>
</a>
</li><!-- end ngRepeat: tenant in tenantList --><li ng-repeat="tenant in tenantList" class="ng-scope">
<a ng-click="selectTenant(1)" href="">
<span ng-show="selectedTenant.Identity == tenant.Identity" class="glyphicon glyphicon-ok ng-hide"></span>
<span ng-show="selectedTenant.Identity != tenant.Identity" style="margin-left: 17px" class=""></span>
<span class="ng-binding">NewTenant1</span>
</a>
</li><!-- end ngRepeat: tenant in tenantList --><li ng-repeat="tenant in tenantList" class="ng-scope">
<a ng-click="selectTenant(2)" href="">
<span ng-show="selectedTenant.Identity == tenant.Identity" class="glyphicon glyphicon-ok ng-hide"></span>
<span ng-show="selectedTenant.Identity != tenant.Identity" style="margin-left: 17px" class=""></span>
<span class="ng-binding">cust2</span>
</a>
</li><!-- end ngRepeat: tenant in tenantList -->
</ul>
</div>
I tried to do through below ways to select but i cant make it work.
wait for the element to become visible.
LinkText
Options to select. (via repeater name as the option)
kindly help me out
element(by.partialLinkText('cust2')); i dono how come linktext is not working but partialLinkText is working. thanks for replies.
Would this suffice? I use this to identify dropdown elements which contain a specific label value...
this.clickDropChoice = function(dropdown, optionChoice) {
dropdown.element(by.cssContainingText('option', optionChoice)).click()
};

Incorrect operation of the "right" in the carousel Bootstrap?

Pressing the "right" after 3 slides, the page becomes white.
But when you press the "left", ie go to the previous slide all goes well, the slides are changing.
Why are the buttons do not work the same way (to the right) causes a white screen?
<div class="container">
<div id="myCarousel" class="carousel">
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<!--First slide-->
<div class="item active">
<img src="http://picsfab.com/download/image/26763/800x600_dogs-caravan.jpg" style="height: 100%; width: 100%; display: block;">
<!--For text to be centered-->
<div class="container">
<div class="carousel-caption">
<h1>It's my dogs. Welcome.</h1>
<p>This tag will container the text.
This tag will container the text.
This tag will container the text.
</p>
<p><a class="btn btn-sm btn-primary">Sign up</a></p>
</div>
</div>
</div>
<!--Second slide-->
<div class="item">
<img src="http://picsfab.com/download/image/82752/800x600_yukon-dogs-cold-for-cats-canada-expedition.jpg" style="height: 100%; width: 100%; display: block;">
<!--For text to be centered-->
<div class="container">
<div class="carousel-caption">
<h1>It's my dogs. Welcome.</h1>
<p>This tag will container the text.
This tag will container the text.
This tag will container the text.
</p>
<p><a class="btn btn-sm btn-primary">Sign up</a></p>
</div>
</div>
</div>
<!--Third slide-->
<div class="item">
<img src="http://picsfab.com/download/image/81152/800x600_sobaka-drug-wizard-dog.jpg" style="height: 100%; width: 100%; display: block;">
<!--For text to be centered-->
<div class="container">
<div class="carousel-caption">
<h1>It's my dogs. Welcome.</h1>
<p>This tag will container the text.
This tag will container the text.
This tag will container the text.
</p>
<p><a class="btn btn-sm btn-primary">Sign up</a></p>
</div>
</div>
</div>
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</div> <!-- Carousel inner-->
</div> <!-- Carousel-->
</div> <!-- Container-->
All works!
</div> <!-- Carousel inner-->
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>