I have modal that works correctly, inside modal i have select field like this:
<select name="" id="">
<option value="">test</option>
<option value="">test 1</option>
<option value="">test 2</option>
</select>
My initialization:
$(document).ready(function () {
$('.modal').modal();
$('select').formSelect();
});
Outside modal it works, so maybe there some css changes need to be applied.
Proper working select outside modal select code when opened looks like this:
<ul id="select-options-15eef910-6f5c-ea6f-a7e5-1a9eeb3c4047" class="dropdown-content select-dropdown" tabindex="0" style="display: block; width: 1182.11px; left: 0px; top: -238.984px; height: 284.98px; transform-origin: 0px 100% 0px; opacity: 1; transform: scaleX(1) scaleY(1);"><li id="select-options-15eef910-6f5c-ea6f-a7e5-1a9eeb3c40470" tabindex="0" class=""><span>test</span></li><li id="select-options-15eef910-6f5c-ea6f-a7e5-1a9eeb3c40471" tabindex="0"><span>test 1</span></li><li id="select-options-15eef910-6f5c-ea6f-a7e5-1a9eeb3c40472" tabindex="0"><span>test 2</span></li><li id="select-options-15eef910-6f5c-ea6f-a7e5-1a9eeb3c40473" tabindex="0"><span>test 2</span></li><li id="select-options-15eef910-6f5c-ea6f-a7e5-1a9eeb3c40474" tabindex="0" class=""><span>test 2</span></li><li id="select-options-15eef910-6f5c-ea6f-a7e5-1a9eeb3c40475" tabindex="0" class="selected"><span>test 2</span></li><li id="select-options-15eef910-6f5c-ea6f-a7e5-1a9eeb3c40476" tabindex="0"><span>test 2</span></li></ul>
Don't know how to display that readable here(it's my first question) so basically, it calculates height and other css stuff itself but in modal it looks like this:
Here screenshot
And select field code in browser when opened:
<ul id="select-options-f505c135-4908-3edb-6944-32b5e7f00630" class="dropdown-content select-dropdown" tabindex="0" style="display: block; width: 584.453px; left: 0px; top: 0px; height: 0px; transform-origin: 0px 0px 0px; opacity: 1; transform: scaleX(1) scaleY(1);"><li class="disabled selected" id="select-options-f505c135-4908-3edb-6944-32b5e7f006300" tabindex="0"><span>Выберите роль</span></li><li id="select-options-f505c135-4908-3edb-6944-32b5e7f006301" tabindex="0"><span>Менеджер</span></li><li id="select-options-f505c135-4908-3edb-6944-32b5e7f006302" tabindex="0"><span>"Покупатель"</span></li><li id="select-options-f505c135-4908-3edb-6944-32b5e7f006303" tabindex="0"><span>Admin</span></li></ul>
As you see now calculations in all fields zero.
Searched few hours but didn't find exact answer in my case.
also here my includes:
{{--Material--}}
<link href="css/materialize.min.css" rel="stylesheet">
{{-- Material --}}
<script src="js/materialize.min.js"></script>
so i figured it out myself, as i have few select on my page, but in this case i had only one, anyway the best way to make all materialize select, tooltip and other stuff work from jquery and especially when you have few of each element, better give different class or id for each.
$('#select1').formSelect();
$('#select2').formSelect();
$('.select3').formSelect();
$('.tooltipped').tooltip();
$('.tooltipped2').tooltip();
p.s. i should mention that mostly different element with same class also work, but keep in mind that this bug or whatever it is like mine can happen.
also using " is better for e.g.
$("#role").formSelect();
if you have problem with displaying in modal.
It will be good if someone explain me this, is it some feature in materialize library or something else.Sorry I'm new in frontend, so that will really help.
Related
I want to switch between two slides by using a scroll and I want to have an indicator
to show which of the two slides that are being shown.
Building the scroll part was not very difficult and has been done.
My problem is:
How can I extract the idx value from the for loop to know which one of the to slides that is being shown?
This so that I can present which slide I am on with the indicators.
Scrolling
This is the code for scrolling between the two images.
HTML
<div class="container_large">
<div v-for="(i,idx) in this.slider_header " class="scroll" :key="idx" >
<div :style="{height:'82px', width:'100%'}" v-if="idx==0" >
Slide 1
</div>
<div v-if="idx==1" :style="{height:'92px', width:'100%'}" >
Slide 2
</div>
</div>
</div>
CSS
.container_large{
width: 100%;
/* width: 90%; */
display: flex;
overflow-x: scroll;
margin-left: 0%;
height: 99px;
position: absolute;
margin-top: 27%;
z-index: 2;
}
.scroll{
min-width:388px;
position: relative;
margin-top: 0%;
border-radius: 8px;
display: flex;
height: 92px;
z-index: 1;
margin-left: 2%;
object-fit: cover;
}
Indicators
This code is for the indicators to show which of the two images that are being shown at the moment.
<div :style="{height:'15px', position:'absolute',marginTop:'51%',borderRadius:'8px',zIndex:'3', width:'30px',marginLeft:'43%',backgroundColor:'grey'}">
<div id="slide1" :style="{borderRadius:'50%',height:'13px',marginLeft:'8%',marginTop:'1.5%', width:'13px', zIndex:'4',backgroundColor:'white'}">
</div>
<div id="slide2" :style="{borderRadius:'50%',height:'13px',marginLeft:'51%',marginTop:'1.5%', width:'13px', zIndex:'4',backgroundColor:'white'}">
</div>
</div>
I would like to add v-if="idx==0" and v-if="idx==1" to id="slide1" and id="slide2" respectively to show which one of them that is being seen but
since they fall outside of the for loop this doesn't work.
Question
How can I catch the idx value or solve this in some other way to present which slide that I am on?
Ok so I think you have too much v-if inside your v-for.
There is no need to create all of your slides with to then only render one of them with series of conditions.
Have you considered something like this?
<div class="container_large">
<div
class="slide"
:style="slides[activeSlide].style">
{{slides[activeSlide].text}}
</div>
</div>
<div id="abc">
<div id="bac" ngIf="show">
<!-- Content -->
</div>
<div id="cde">cds</div>
</div>
I have a div want to add or remove from DOM slowly(show and hide) using *ngIf and likewise adding or removing of div.id ="bac" should cause div.id='cde' to move left or right slowly like it is animating.
*ngIf probably is not he best thing you are looking for, instead of this, use ngClass and define the css transitions and positions for these animations.
*ngIf fully hides/shows a node from/in DOM, it's like display: none/block which is not able to be animated through css-transitions
here is an example
<div class="animated" [ngClass]=" { 'show': show, 'hide': !show }">
content
</div>
then in the css
.animated {
display: inline-block;
width: 100%;
height: 80px;
background: gray;
transition: 1.5s linear margin-left;
}
.animated.show {
margin-left: 0;
}
.animated.hide {
margin-left: -120vw;
}
Height also can be changed, depends on which effect you expect.
Here is stackblitz with working code
The concept of frames is being used on a website I am tasked with testing. However, the frames do not use frame tags, one is for example a div that is filled by GET/POST. Selenium cannot access the element inside of the frame (ElementNotVisibleException) because it must first switch to the frame. But, I can't switch to the frame because it is not technically a frame in Selenium's eyes. How can I access the content of the frame without manipulating the DOM? (The point of testing is that we test what is there as an end user and don't change it). So, I cannot use JavaScript executor. I have tried using action building to click elements/move to the element, but it returns errors.
EDIT:
Here is the basic form of the html I'm trying to access. I cannot use selenium to access any elements inside el1. I need to select an option for el6.
<div id="el1" style="width: 960px; height: 230px; margin-bottom: 6px;">
<div style="width: 955px;padding: 5px 0px 0px 5px;">
<span>Text Here</span>
<form id="el2" action="pageName.jsp?action=blah" method="POST" style="height: 300px;" name="el2">
<div id="el3" style="width: 600px; margin: 20px 0px 0px 60px;">
<div id="el4" style="height: 20px;">
<div id="el5" style="height: 20px; padding-left: 40px;">
<div style="width: 400px;">
<span style="font-weight: bold;">More Text Here</span>
</div>
<div style="width: 400px;">
<select id="el6" onchange="javascriptfunction(this)" name="el6" style="width: 400px;">
<option selected="selected" value="">A Select Box Option</option>
<option value="NumberHere">More Options Populated By JSP</option>
</select>
</div>
</div>
</div>
</div>
<!--Some Unnecessary content here-->
</form>
</div>
</div>
Here is style calculation for el6. I have tried manually adjusting height with WebDriver in attempt to get rid of ElementNotVisibleException. This did not work.
font-family MS Shell Dlg
body Helvetica,Arial,Sans-Serif
div Arial,Helvetica,Geneva,sans-serif
body Arial,Helvetica,Geneva,sans-serif
font-size 13.3333px
div 14px
body 13px
color rgb(0, 0, 0)
#container #333
text-align start
#wrapper left
.bodyStyle center
width 400px
margin-top 0px
margin-right 0px
margin-bottom 0px
margin-left 0px
padding-top 0px
padding-right 0px
padding-bottom 0px
padding-left 0px
why can't you switch to any available iframe without specifying the ID or name.
you can do this just switch to iframe..
try this
driver.switchTo().frame(driver.findElement(By.cssSelector("iframe")));
If you are getting ElementNotVisibleException,it means element is invisible at that time.You can use explicit wait to achieve this :
WebDriverWait wait = new WebDriverWait(driver,<Time>);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("el6")));
First,you calculate time which is taken by element to visible and replace with <Time>.
For more detail,you can [see][1].
[1]: http://docs.seleniumhq.org/docs/04_webdriver_advanced.jsp
I need some help with header icons. I add icons near logo, and i want to make them with link, but they are not working.I can click on logo, but I can't click on them.
Here is the part of code:
<a id="header_logo" href="{$base_dir}" title="{$shop_name|escape:'htmlall':'UTF-8'}">
<img class="logo" style="margin-bottom:10px;" src="https://www.irankiuparduotuve.lt/img/irankiu-parduotuve.png" alt="{$shop_name|escape:'htmlall':'UTF-8'}" />
</a>
<a href="https://www.irankiuparduotuve.lt/info/kaip-pirkti/#4">
<img style="margin-bottom:10px; position: absolute; top: 13%; left: 23%;" src="https://www.irankiuparduotuve.lt/img/saugu.png" alt="Saugu pirkti!" />
</a>
<a href="https://www.irankiuparduotuve.lt/info/kaip-pirkti/#7">
<img style="margin-bottom:10px; position: absolute; top: 13%; left: 31%;" src="https://www.irankiuparduotuve.lt/img/pristatymas.png" alt="Pristatymas visoje Lietuvoje!" />
</a>
And this is how it looks like on website
it's probably cause by poorly written CSS rules. Your logos are positioned using position:absolute;,which is causing all the trouble. The anchor element <a> is positioned statically, meanwhile the image inside is position:absolute;. Therefore, the anchor element doesnt have any height or width and is unclickble.
What you can do is edit the CSS rules for anchor and image tags:
<a href="https://www.irankiuparduotuve.lt/info/kaip-pirkti/#7" style="
z-index: 11; margin-bottom: 10px;
position: absolute; top: 13%;
left: 31%; display: inline-block;">
<img style="/* margin-bottom:10px; */ /* position: absolute; */
/* top: 13%; */ /* left: 31%; */
/* display: inline-block; */"
src="https://www.irankiuparduotuve.lt/img/pristatymas.png">
</a>
Sorry for poor formatting. Basically you need to apply yout positionin rules to <a> element, not the <img>
Sėkmės!
Hey guys, my first question here on stack overflow. Trying to get something pretty simple to work, I'm sure I'm missing something quite obvious. Still getting used to the "standard" css, too many years working with non-functional ones! Heh.
So, sample of what I'm doing:
<div style="overflow: auto; border: 1px solid">
hello
<div style="position: relative; z-index: 99999; top: 0px; left: 0px;">
<div style="z-index: 99999; overflow-y: hidden; position: absolute; overflow: hidden; height: 200px; left: 0; auto: 0">
<ul>
<li >New</li>
<li >Old</li>
</ul>
</div>
</div>
</div>
In essence: The first div is a container, that I would like to automatically overflow as content is added. Inside of that container, I have a popup menu, which I have simplified here. The popup menu appears (as it should) directly under "hello".
My problem, however, is that instead of the popup menu "coming out" of the parent, as would be expected by the absolute position, it is actually causing a scrollbar to appear on the parent.
I know that if I take otu the "position: relative" it works, but then it no longer appars where I want it (directly under the previous element).
What am I missing here?
EDIT: Sample here: http://marcos.metx.net/OverflowTest.htm
first of all - Inline styling is a big no no.
It is best to include a style sheet and apply it to individual div's via the "id" or "class" attributes.
Please read up on standards compliant css at w3schools
The problem is your overflow property.
auto - "If overflow is clipped, a scroll-bar should be added to see the rest of the content"
What you are looking for is "overflow: visible;"
Using position: absolute instead of relative on that middle div will solve your problem. This gives you (with an added border color on the inner-most div):
alt text http://img.skitch.com/20100211-x8mnu5ds4exphbdbg956cuj6ea.png
And here is the updated source code:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
</head>
<body>
<div style="overflow: auto; border: 1px solid">
hello
<div style="position: absolute; z-index: 99999">
<div style="z-index: 99999; overflow-y: hidden; position: absolute;
overflow: hidden; height: 200px; left: 0; auto: 0;
border: 1px solid red">
<ul>
<li >New</li>
<li >Old</li>
</ul>
</div>
</div>
</div>
</body>
</html>
For more on this, see Absolutely positioned box inside a box with overflow: auto or hidden.